def METHOD_NAME(f):
    @wraps(f)
    def decorated_function(*args, **kwargs):
        if input_schema:
            if request.get_json():
                request_data = request.get_json()
            else:
                request_data = request.args
            data, errors = input_schema.load(request_data)
            if errors:
                return wrap_errors(errors), 400
            kwargs["data"] = data
        try:
            resp = f(*args, **kwargs)
        except Exception as e:
            capture_exception()
            current_app.logger.exception(e)
            return dict(message=str(e)), 500
        if isinstance(resp, tuple):
            return resp[0], resp[1]
        if not resp:
            return dict(message="No data found"), 404
        if callable(output_schema):
            output_schema_to_use = output_schema()
        else:
            output_schema_to_use = output_schema
        return unwrap_pagination(resp, output_schema_to_use), 200
    return decorated_function