<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _is_endpoint_method(handler):
 """ from the context. Unfortunately, we can't directly detect whether a handler is an Endpoint method, because at the time of decoration, the class doesn't actually exist yet so it's impossible to get a reference to it. So, we use the heuristic of seeing if the handler takes only a single ``self`` param and there is an Endpoint class in the handler's globals. """

    params = signature(handler).parameters
    has_self = len(params) == 1 and list(params.keys())[0] == 'self'
    has_endpoint_class = any(isclass(g) and issubclass(g, Endpoint)
                             for g in handler.__globals__.values())
    return has_self and has_endpoint_class