def module_has_function(m, fname):
    return hasattr(m, fname) and inspect.isfunction(getattr(m, fname))
if __name__ == '__main__':
    for m in whereis_in_locals('walk'):
        pass
In Python, given a function name, how to get all the modules containing the function?