def latest_version(*names, **kwargs):
    refresh = salt.utils.is_true(kwargs.pop('refresh', False))

    if len(names) == 0:
        return ''

    # Refresh before looking for the latest version available
    if refresh:
        refresh_db()

    ret = {}
    # Initialize the dict with empty strings
    for name in names:
        ret[name] = ''
    cmd = ['pacman', '-Sp', '--needed', '--print-format', '%n %v']
    cmd.extend(names)

    if 'root' in kwargs:
        cmd.extend(('-r', kwargs['root']))

    out = __salt__['cmd.run_stdout'](cmd,
                                     output_loglevel='trace',
                                     python_shell=False)
    for line in salt.utils.itertools.split(out, '\n'):
        try:
            name, version_num = line.split()
            # Only add to return dict if package is in the list of packages
            # passed, otherwise dependencies will make their way into the
            # return data.
            if name in names:
                ret[name] = version_num
        except (ValueError, IndexError):
            pass

    pkgs = {}

    for name in names:
        if not ret[name]:
            if not pkgs:
                pkgs = list_pkgs()
            if name in pkgs:
                ret[name] = pkgs[name]
    # Return a string if only one package name passed
    if len(names) == 1:
        return ret[names[0]]
    return ret

# available_version is being deprecated
Returns all tests with the given prefix in the DB.
dataset/ETHPy150Open saltstack/salt/salt/modules/pacman.py/latest_version--crossover with--dataset/ETHPy150Open openstack-infra/subunit2sql/subunit2sql/db/api.py/get_tests_by_prefix