def module_of (object) :
    """Returns the name of the module defining `object`, if possible.

       `module_of` works for classes, functions, and class proxies.
    """
    try :
        object = object.__dict__ ["Essence"]
    except (AttributeError, KeyError, TypeError) :
        pass
    result = getattr (object, "__module__", None)
    if not result :
        globals = getattr (object, "func_globals", None)
        if globals :
            result = globals.get ("__name__")
    return result