def _call_and_format(self, req, props=None):
        """
        Invokes a single request against a handler using _call() and traps any errors,
        formatting them using _err().  If the request is successful it is wrapped in a
        JSON-RPC 2.0 compliant dict with keys: 'jsonrpc', 'id', 'result'.

        :Parameters:
          req
            A single dict representing a single JSON-RPC request
          props
            Application defined properties to set on RequestContext for use with filters.
            For example: authentication headers.  Must be a dict.
        """
        if not isinstance(req, dict):
            return err_response(None, ERR_INVALID_REQ,
                                "Invalid Request. %s is not an object." % str(req))

        reqid = None
        if "id" in req:
            reqid = req["id"]

        if props is None:
            props = {}
        context = RequestContext(props, req)

        if self.filters:
            for f in self.filters:
                f.pre(context)

        if context.error:
            return context.error

        resp = None
        try:
            result = self._call(context)
            resp = {"jsonrpc": "2.0", "id": reqid, "result": result}
        except RpcException as e:
            resp = err_response(reqid, e.code, e.msg, e.data)
        except Exception as e:
            self.log.exception("Error processing request: %s" % str(req))
            resp = err_response(reqid, ERR_UNKNOWN, "Server error. Check logs for details.",
                                data={
                                    'exception': str(e)
                                })

        if self.filters:
            context.response = resp
            for f in self.filters:
                f.post(context)

        return resp
dataset/ETHPy150Open StackHut/stackhut/stackhut_toolkit/common/barrister/runtime.py/Server._call_and_format/original