@classmethod<EOL><INDENT>def _get_responses(cls, requests, dispatcher):<DEDENT>
for request in requests:<EOL><INDENT>def response(**kwargs):<EOL><INDENT>return cls.RESPONSE_CLASS_MAP[request.JSONRPC_VERSION](<EOL>_id=request._id, **kwargs)<EOL><DEDENT>try:<EOL><INDENT>method = dispatcher[request.method]<EOL><DEDENT>except KeyError:<EOL><INDENT>output = response(error=JSONRPCMethodNotFound()._data)<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>result = method(*request.args, **request.kwargs)<EOL><DEDENT>except JSONRPCDispatchException as e:<EOL><INDENT>output = response(error=e.error._data)<EOL><DEDENT>except Exception as e:<EOL><INDENT>data = {<EOL>"<STR_LIT:type>": e.__class__.__name__,<EOL>"<STR_LIT:args>": e.args,<EOL>"<STR_LIT:message>": str(e),<EOL>}<EOL>if isinstance(e, TypeError) and is_invalid_params(<EOL>method, *request.args, **request.kwargs):<EOL><INDENT>output = response(<EOL>error=JSONRPCInvalidParams(data=data)._data)<EOL><DEDENT>else:<EOL><INDENT>print("<STR_LIT>".format(data))<EOL>output = response(<EOL>error=JSONRPCServerError(data=data)._data)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>output = response(result=result)<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>if not request.is_notification:<EOL><INDENT>yield output<EOL><DEDENT><DEDENT><DEDENT>
Response to each single JSON-RPC Request.

        :return iterator(JSONRPC20Response):

        .. versionadded: 1.9.0
          TypeError inside the function is distinguished from Invalid Params.