| **Provider discovery check**
    looks into ``netshowlib/provider_discovery`` path for any \
    provider discovery files, and runs \
    the ``name_and_priority()`` function. If this function returns a hash with an \
    operating system name and priority, then this is put in a dict. \
    The OS with the max priority is chosen as the desired OS to use and the OS name \
    is returned

    :return: OS name of best match.

def provider_check():
    """
    | **Provider discovery check**
    looks into ``netshowlib/provider_discovery`` path for any \
    provider discovery files, and runs \
    the ``name_and_priority()`` function. If this function returns a hash with an \
    operating system name and priority, then this is put in a dict. \
    The OS with the max priority is chosen as the desired OS to use and the OS name \
    is returned

    :return: OS name of best match.
    """

    # get a list of files under the provider_discovery path
    # use pkg_resources to figure it out
    install_location = pkg_resources.require('netshow-core-lib')[0].location
    _dir_entries = glob.glob(install_location + "/../../../share/netshow-lib/providers/*")
    _providernames = {}
    # run os discovery check returns hash entries that look like this
    # { 'linux': 0 }. the integer is a priority . The lower the priority
    # the less likely the os is a match
    for _entry in _dir_entries:
        import_str = \
            "netshowlib.%s.provider_discovery" % \
            os.path.basename(_entry)
        providername = import_module(import_str)
        result = providername.name_and_priority()
        if result:
            _providernames.update(result)

    if _providernames:
        return max(_providernames.items(), key=operator.itemgetter(1))[0].lower()
    # if no OS found, return none
    return None