code: def err_response(reqid, code, msg, data=None):
      
      err = { "code": code, "message": msg }
      if data:
          err["data"] = data
      return { "jsonrpc": "2.0", "id": reqid, "error": err }
docs: Formats a JSON-RPC error as a dict with keys: 'jsonrpc', 'id', 'error'