def get_version_using_importlib_metadata(module):
    """
    Uses the importlib_metadata backport to read the version.
    See https://importlib-metadata.readthedocs.io/en/latest/using.html#overview

    Note: unfortunately this provides very bad answers in some cases (e.g. when the module is built-in)
    so we have to protect against them

    :param module:
    :return:
    """
    from importlib_metadata import distribution
    dist = distribution(module.__name__)
    if dist.metadata['Name'] == module.__name__:
        return dist.version
