def METHOD_NAME(fn, self, *args, **kwargs):
    try:
        if self._req_context:
            THREAD_LOCAL.request_context = self._req_context
    except AttributeError:
        # sometimes there is a race condition where the previous patch has not been applied yet
        pass
    return fn(self, *args, **kwargs)