@defer.inlineCallbacks
    def call_py(self, jsondata):
        """
        Calls jsonrpc service's method and returns its return value in python
        object format or None if there is none.

        This method is same as call() except the return value is a python
        object instead of JSON string. This method is mainly only useful for
        debugging purposes.
        """
        try:
            try:
                rdata = json.loads(jsondata)
            except __HOLE__:
                raise ParseError
        except ParseError, e:
            defer.returnValue(self._get_err(e))
            return

        # set some default values for error handling
        request = self._get_default_vals()

        try:
            if isinstance(rdata, dict) and rdata:
                # It's a single request.
                self._fill_request(request, rdata)
                respond = yield self._handle_request(request)

                # Don't respond to notifications
                if respond is None:
                    defer.returnValue(None)
                else:
                    defer.returnValue(respond)
                return
            elif isinstance(rdata, list) and rdata:
                # It's a batch.
                requests = []
                responds = []

                for rdata_ in rdata:
                    # set some default values for error handling
                    request_ = self._get_default_vals()
                    try:
                        self._fill_request(request_, rdata_)
                    except InvalidRequestError, e:
                        err = self._get_err(e, request_['id'])
                        if err:
                            responds.append(err)
                        continue
                    except JSONRPCError, e:
                        err = self._get_err(e, request_['id'])
                        if err:
                            responds.append(err)
                        continue

                    requests.append(request_)

                for request_ in requests:
                    try:
                        # TODO: We should use a deferred list so requests
                        #       are processed in parallel
                        respond = yield self._handle_request(request_)
                    except JSONRPCError, e:
                        respond = self._get_err(e,
                                                request_['id'],
                                                request_['jsonrpc'])

                    # Don't respond to notifications
                    if respond is not None:
                        responds.append(respond)

                if responds:
                    defer.returnValue(responds)
                    return

                # Nothing to respond.
                defer.returnValue(None)
                return
            else:
                # empty dict, list or wrong type
                raise InvalidRequestError
        except InvalidRequestError, e:
            defer.returnValue(self._get_err(e, request['id']))
        except JSONRPCError, e:
            defer.returnValue(self._get_err(e,
                                            request['id'],
                                            request['jsonrpc']))
dataset/ETHPy150Open flowroute/txjason/txjason/service.py/JSONRPCService.call_py