def get_name_variants(pkg):
    # type: (STRING_TYPE) -> Set[STRING_TYPE]
    """
    Given a packager name, get the variants of its name for both the canonicalized
    and "safe" forms.

    :param AnyStr pkg: The package to lookup
    :returns: A list of names.
    :rtype: Set
    """

    if not isinstance(pkg, six.string_types):
        raise TypeError("must provide a string to derive package names")
    from pkg_resources import safe_name
    from packaging.utils import canonicalize_name

    pkg = pkg.lower()
    names = {safe_name(pkg), canonicalize_name(pkg), pkg.replace("-", "_")}
    return names
Given a packager name, get the variants of its name for both the canonicalized
    and "safe" forms.

    :param AnyStr pkg: The package to lookup
    :returns: A list of names.
    :rtype: Set