Returns the module object of the module this function is called from

def this_module(npop=1):
    '''Returns the module object of the module this function is called from
    '''
    stack = inspect.stack()
    st = stack[npop]
    frame = st[0]
    return inspect.getmodule(frame)