def is_module_function(obj):
    'Return True if `obj` is a module-global function\n\n    >>> import os\n    >>> is_module_function(os.path.exists)\n    True\n\n    >>> is_module_function(lambda: None)\n    False\n\n    '
    return (hasattr(obj, '__class__') and isinstance(obj, (types.FunctionType, types.BuiltinFunctionType)) and hasattr(obj, '__module__') and hasattr(obj, '__name__') and (obj.__name__ != '<lambda>'))
Return True if `obj` is a module-global function

>>> import os
>>> is_module_function(os.path.exists)
True

>>> is_module_function(lambda: None)
False
def is_module_function(obj):
    'Return True if `obj` is a module-global function\n\n    >>> import os\n    >>> is_module_function(os.path.exists)\n    True\n\n    >>> is_module_function(lambda: None)\n    False\n\n    '
    return (hasattr(obj, '__class__') and isinstance(obj, (types.FunctionType, types.BuiltinFunctionType)) and hasattr(obj, '__module__') and hasattr(obj, '__name__') and (obj.__name__ != '<lambda>'))