<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_handler(ptr, method):
 """ Dereference the pointer and return the handler method. """

    obj = CACHE.get(ptr, None)
    if obj is None:
        raise BridgeReferenceError(
            "Reference id={} never existed or has already been destroyed"
            .format(ptr))
    elif not hasattr(obj, method):
        raise NotImplementedError("{}.{} is not implemented.".format(obj,
                                                                     method))
    return obj, getattr(obj, method)