def name_that_thing(thing):
    # Instance method
    if hasattr(thing, "im_class"):
        return name_that_thing(thing.im_class) + "." + thing.im_func.func_name
    # Other named thing
    if hasattr(thing, "__name__"):
        if hasattr(thing, "__class__") and not isinstance(thing, types.FunctionType):
            if thing.__class__ is not type:
                return name_that_thing(thing.__class__)
        if hasattr(thing, "__module__"):
            return "%s.%s" % (thing.__module__, thing.__name__)
    # Generic instance of a class
    if hasattr(thing, "__class__"):
        return name_that_thing(thing.__class__)
    return repr(thing)
Method called when hooking this callback.
dataset/ETHPy150Open andrewgodwin/channels/channels/utils.py/name_that_thing--crossover with--dataset/ETHPy150Open ProgVal/Limnoria/src/httpserver.py/SupyHTTPServerCallback.doHook