def list_upgrades(refresh=False, root=None, **kwargs):  # pylint: disable=W0613
    '''
    List all available package upgrades on this system

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_upgrades
    '''
    upgrades = {}
    cmd = ['pacman', '-S', '-p', '-u', '--print-format', '%n %v']

    if root is not None:
        cmd.extend(('-r', root))

    if refresh:
        cmd.append('-y')

    call = __salt__['cmd.run_all'](cmd,
                                   python_shell=False,
                                   output_loglevel='trace')

    if call['retcode'] != 0:
        comment = ''
        if 'stderr' in call:
            comment += call['stderr']
        if 'stdout' in call:
            comment += call['stdout']
        if comment:
            comment = ': ' + comment
        raise CommandExecutionError('Error listing upgrades' + comment)
    else:
        out = call['stdout']

    for line in salt.utils.itertools.split(out, '\n'):
        try:
            pkgname, pkgver = line.split()
        except ValueError:
            continue
        if pkgname.lower() == 'downloading' and '.db' in pkgver.lower():
            # Antergos (and possibly other Arch derivatives) add lines when pkg
            # metadata is being downloaded. Because these lines, when split,
            # contain two columns (i.e. 'downloading community.db...'), we will
            # skip this line to keep it from being interpreted as an upgrade.
            continue
        upgrades[pkgname] = pkgver
    return upgrades
List all available package upgrades on this system

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_upgrades