Attempts to return the module in which `o` is defined.

def _safe_getmodule(o):
    """Attempts to return the module in which `o` is defined.
    """
    from inspect import getmodule
    try:
        return getmodule(o)
    except: # pragma: no cover
        #There is nothing we can do about this for now.
        msg.err("_safe_getmodule: {}".format(o), 2)
        pass