def get_module_name(module: types.ModuleType) -> str:
    """
    Returns the name of the specified module by looking up its name in
    multiple ways to prevent incompatibility issues.

    :param module:
        A module object for which to retrieve the name.
    """
    try:
        return module.__spec__.name
    except AttributeError:
        return module.__name__
def get_module_name ( module : types . ModuleType ) -> str : try : return module . __spec__ . name except AttributeError : return module . __name__
Returns the name of the specified module by looking up its name in
    multiple ways to prevent incompatibility issues.

    :param module:
        A module object for which to retrieve the name.