code: def call_method(self, method, *args):
          
          message = self._version.create_request(method, args)
          msgid = message['id']
          try:
              with switch_back(self._timeout) as switcher:
                  self._method_calls[msgid] = switcher
                  self.send_message(message)
                  args, _ = self._hub.switch()
          finally:
              self._method_calls.pop(msgid, None)
          response = args[0]
          assert response['id'] == msgid
          error = response.get('error')
          if error is not None:
              raise JsonRpcError('error response calling "{}"'.format(method), error)
          return response['result']
docs: Call a JSON-RPC method and wait for its result.
  
          The *method* is called with positional arguments *args*.
  
          On success, the ``result`` field from the JSON-RPC response is
          returned.  On error, a :class:`JsonRpcError` is raised, which you can
          use to access the ``error`` field of the JSON-RPC response.