human
Give me a the Python program you requested given the following:
Complete the below
def latest_version(*names, **kwargs):

    ''''Return the latest version of the named package available for upgrade or
    installation
    Currently chooses stable versions, falling back to devel if that does not
    exist.
    CLI Example:
    .. code-block:: bash
    salt \'*\' pkg.latest_version <package name>
    salt \'*\' pkg.latest_version <package1> <package2> <package3>'
    '''
assistant
#Here is the Python program you requested.
    refresh = salt.utils.is_true(kwargs.pop('refresh', True))
    if refresh:
        refresh_db()
    def get_version(pkg_info):
        return (pkg_info['versions']['stable'] or pkg_info['versions']['devel'])
    versions_dict = dict(((key, get_version(val)) for (key, val) in six.iteritems(_info(*names))))
    if (len(names) == 1):
        return next(six.itervalues(versions_dict))
    else:
        return versions_dict