code: def handle_request(self, msgtype, msgid, method, args, kwargs):
          
          response = None
          error = None
          exception = None
  
          try:
              response = self.dispatch.call(method, args, kwargs)
          except Exception as e:
              error = (e.__class__.__name__, str(e))
              exception = e
  
          if isinstance(response, Deferred):
              response.add_callback(self.send_response, msgid)
              response.add_errback(self.send_error, msgid)
          else:
              if exception is None:
                  self.send_response(msgid, response)
              else:
                  self.send_error(msgid, exception)
docs: Handle a request.