import inspect


def function_path(fn):
    """
    Returns the name of the function along with the module containing it:
    module.submodule.name
    """
    module = inspect.getmodule(fn)

    if module is not None:
        return '{}.{}'.format(module.__name__, fn.__name__)
    else:
        return fn.__name__