(obj: Any)
return callable(obj) and obj.__name__ in sys.modules[obj.__module__].__dict__
Determine whether the given object is a top-level function, i.e., defined at module scope using 'def'.
Determine whether the given object is a top-level function, i.e., defined at module scope using 'def'.
Determine whether the given object is a top - level function i . e . defined at module scope using def .
def is_top_level_function(obj: Any) -> bool:
    """Determine whether the given object is a top-level function, i.e., defined at module scope using 'def'."""
    return callable(obj) and obj.__name__ in sys.modules[obj.__module__].__dict__
def is_top_level_function ( obj : Any ) -> bool : return callable ( obj ) and obj . __name__ in sys . modules [ obj . __module__ ] . __dict__