def _call(self, context):
        """
        Executes a single request against a handler.  If the req.method == 'common.barrister-idl', the
        Contract IDL JSON structure is returned.  Otherwise the method is resolved to a handler
        based on the interface name, and the appropriate function is called on the handler.

        :Parameter:
          req
            A dict representing a valid JSON-RPC 2.0 request.  'method' must be provided.
        """
        req = context.request
        if "method" not in req:
            raise RpcException(ERR_INVALID_REQ, "Invalid Request. No 'method'.")

        method = req["method"]

        if method == "common.barrister-idl" or method == "getIdl":
            return self.contract.idl_parsed

        iface_name, func_name = unpack_method(method)

        if iface_name in self.handlers:
            iface_impl = self.handlers[iface_name]
            func = getattr(iface_impl, func_name)
            if func:
                if "params" in req:
                    params = req["params"]
                else:
                    params = []

                if self.validate_req:
                    self.contract.validate_request(iface_name, func_name, params)

                if hasattr(iface_impl, "barrister_pre"):
                    pre_hook = getattr(iface_impl, "barrister_pre")
                    pre_hook(context, params)

                if params:
                    result = func(*params)
                else:
                    result = func()

                if self.validate_resp:
                    self.contract.validate_response(iface_name, func_name, result)
                return result
            else:
                msg = "Method '%s' not found" % method
                raise RpcException(ERR_METHOD_NOT_FOUND, msg)
        else:
            msg = "No implementation of '%s' found" % iface_name
            raise RpcException(ERR_METHOD_NOT_FOUND, msg)
dataset/ETHPy150Open StackHut/stackhut/stackhut_toolkit/common/barrister/runtime.py/Server._call/original