def process(self, data):
    if data.get('jsonrpc') != "2.0":
      return {'jsonrpc':'2.0',
              'id':data.get('id'),
              'error':{'code':INVALID_REQUEST,
                       'message':errors[INVALID_REQUEST]}}
    if 'method' not in data:
      return {'jsonrpc':'2.0',
              'id':data.get('id'),
              'error':{'code':INVALID_REQUEST,
                       'message':errors[INVALID_REQUEST]}}
      
    methodname = data['method']
    if not isinstance(methodname, basestring):
      return {'jsonrpc':'2.0',
              'id':data.get('id'),
              'error':{'code':INVALID_REQUEST,
                       'message':errors[INVALID_REQUEST]}}
      
    if methodname.startswith('_'):
      return {'jsonrpc':'2.0',
              'id':data.get('id'),
              'error':{'code':METHOD_NOT_FOUND,
                       'message':errors[METHOD_NOT_FOUND]}}


    if methodname not in self.methods:
      return {'jsonrpc':'2.0',
              'id':data.get('id'),
              'error':{'code':METHOD_NOT_FOUND,
                       'message':errors[METHOD_NOT_FOUND]}}


    method = self.methods[methodname]
    try:
      params = data.get('params', [])
      if isinstance(params, list):
        result = method(*params)
      elif isinstance(params, dict):
        result = method(**dict([(str(k), v) for k, v in params.iteritems()]))
      else:
        return {'jsonrpc':'2.0',
                'id':data.get('id'),
                'error':{'code':INVALID_REQUEST,
                         'message':errors[INVALID_REQUEST]}}
      resdata = None
      if data.get('id'):

        resdata = {
          'jsonrpc':'2.0',
          'id':data.get('id'),
          'result':result,
        }
      return resdata
    except Exception, e:
      return {'jsonrpc':'2.0',
              'id':data.get('id'),
              'error':{'code':INTERNAL_ERROR,
                       'message':errors[INTERNAL_ERROR],
                       'data':str(e)}}
dataset/ETHPy150Open IanLewis/kay/kay/ext/jsonrpc2/__init__.py/JsonRpcApplication.process/original