code: def _get_responses(cls, requests, dispatcher):
          
          for request in requests:
              def response(**kwargs):
                  return cls.RESPONSE_CLASS_MAP[request.JSONRPC_VERSION](
                      _id=request._id, **kwargs)
  
              try:
                  method = dispatcher[request.method]
              except KeyError:
                  output = response(error=JSONRPCMethodNotFound()._data)
              else:
                  try:
                      result = method(*request.args, **request.kwargs)
                  except JSONRPCDispatchException as e:
                      output = response(error=e.error._data)
                  except Exception as e:
                      data = {
                          "type": e.__class__.__name__,
                          "args": e.args,
                          "message": str(e),
                      }
                      if isinstance(e, TypeError) and is_invalid_params(
                              method, *request.args, **request.kwargs):
                          output = response(
                              error=JSONRPCInvalidParams(data=data)._data)
                      else:
                          # logger.exception("API Exception: {0}".format(data))
                          print("API Exception: {0}".format(data))
                          output = response(
                              error=JSONRPCServerError(data=data)._data)
                  else:
                      output = response(result=result)
              finally:
                  if not request.is_notification:
                      yield output
docs: Response to each single JSON-RPC Request.
  
          :return iterator(JSONRPC20Response):
  
          .. versionadded: 1.9.0
            TypeError inside the function is distinguished from Invalid Params.