List all available package upgrades.

    .. versionadded:: 2018.3.0

    refresh
        Whether or not to refresh the package database before installing.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_upgrades

def list_upgrades(refresh=True, **kwargs):
    '''
    List all available package upgrades.

    .. versionadded:: 2018.3.0

    refresh
        Whether or not to refresh the package database before installing.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_upgrades
    '''
    pkgs = {}
    for pkg in sorted(list_pkgs(refresh=refresh).keys()):
        # NOTE: we already optionally refreshed in de list_pkg call
        pkg_upgrade = latest_version(pkg, refresh=False)
        if pkg_upgrade:
            pkgs[pkg] = pkg_upgrade
    return pkgs