def METHOD_NAME(self, request, context):
    result = None
    try:
        query = pickle.loads(request.query)
        logger.info(
            "%s.query: calling 'query' with query - %s",
            self.__class__.__name__,
            query,
        )
        handler = self._get_handler(request.context)
        res = handler.query(query)
        data = pickle.dumps(res.data_frame)
        result = common_pb2.Response(
            type=res.resp_type,
            data_frame=data,
            query=res.query,
            error_code=res.error_code,
            error_message=res.error_message
        )
    except Exception:
        msg = traceback.format_exc()
        logger.error("%s.query: error - %s", self.__class__.__name__, msg)
        result = common_pb2.Response(
            type=RESPONSE_TYPE.ERROR,
            data_frame=None,
            query=0,
            error_code=1,
            error_message=msg
        )
    return result