human
Complete this python program:
def list_repo_pkgs(*args, **kwargs):
assistant
#Here is the Python program you requested.

    """.. versionadded:: 2014.1.0
    .. versionchanged:: 2014.7.0
    All available versions of each package are now returned. This required
    a slight modification to the structure of the return dict. The return
    data shown below reflects the updated return dict structure. Note that
    packages which are version-locked using :py:mod:`pkg.hold
    <salt.modules.yumpkg.hold>` will only show the currently-installed
    version, as locking a package will make other versions appear
    unavailable to yum/dnf.
    .. versionchanged:: 2017.7.0
    By default, the versions for each package are no longer organized by
    repository. To get results organized by repository, use
    ``byrepo=True``.
    Returns all available packages. Optionally, package names (and name globs)
    can be passed and the results will be filtered to packages matching those
    names. This is recommended as it speeds up the function considerably.
    .. warning::
    Running this function on RHEL/CentOS 6 and earlier will be more
    resource-intensive, as the version of yum that ships with older
    RHEL/CentOS has no yum subcommand for listing packages from a
    repository. Thus, a ``yum list installed`` and ``yum list available``
    are run, which generates a lot of output, which must then be analyzed
    to determine which package information to include in the return data.
    This function can be helpful in discovering the version or repo to specify
    in a :mod:`pkg.installed <salt.states.pkg.installed>` state.
    The return data will be a dictionary mapping package names to a list of
    version numbers, ordered from newest to oldest. If ``byrepo`` is set to
    ``True``, then the return dictionary will contain repository names at the
    top level, and each repository will map packages to lists of version
    numbers. For example:
    .. code-block:: python
    # With byrepo=False (default)
    \bash\: [\4.1.2-15.el6_5.2\,
    \4.1.2-15.el6_5.1\,
    \4.1.2-15.el6_4\],
    \kernel\: [\2.6.32-431.29.2.el6\,
   ..."""
    byrepo = kwargs.pop('byrepo', False)
    cacheonly = kwargs.pop('cacheonly', False)
    fromrepo = (kwargs.pop('fromrepo', '') or '')
    disablerepo = (kwargs.pop('disablerepo', '') or '')
    enablerepo = (kwargs.pop('enablerepo', '') or '')
    repo_arg = _get_repo_options(fromrepo=fromrepo, **kwargs)
    if (fromrepo and (not isinstance(fromrepo, list))):
        try:
            fromrepo = [x.strip() for x in fromrepo.split(',')]
        except AttributeError:
            fromrepo = [x.strip() for x in str(fromrepo).split(',')]
    if (disablerepo and (not isinstance(disablerepo, list))):
        try:
            disablerepo = [x.strip() for x in disablerepo.split(',') if (x != '*')]
        except AttributeError:
            disablerepo = [x.strip() for x in str(disablerepo).split(',') if (x != '*')]
    if (enablerepo and (not isinstance(enablerepo, list))):
        try:
            enablerepo = [x.strip() for x in enablerepo.split(',') if (x != '*')]
        except AttributeError:
            enablerepo = [x.strip() for x in str(enablerepo).split(',') if (x != '*')]
    if fromrepo:
        repos = fromrepo
    else:
        repos = [repo_name for (repo_name, repo_info) in six.iteritems(list_repos()) if ((repo_name in enablerepo) or ((repo_name not in disablerepo) and (str(repo_info.get('enabled', '1')) == '1')))]
    ret = {}
    def _check_args(args, name):
        '\n                                Do    glob    matching    on    args    and    return    True    if    a    match    was    found.\n                                Otherwise,    return    False\n                                '
        for arg in args:
            if fnmatch.fnmatch(name, arg):
                return True
        return False
    def _parse_output(output, strict=False):
        for pkg in _yum_pkginfo(output):
            if (strict and ((pkg.repoid not in repos) or (not _check_args(args, pkg.name)))):
                continue
            repo_dict = ret.setdefault(pkg.repoid, {})
            version_list =...