def _get_available(recommended=False, restart=False):
    cmd = ['softwareupdate', '--list']
    out = salt.utils.mac_utils.execute_return_result(cmd)

    # rexp parses lines that look like the following:
    #    * Safari6.1.2MountainLion-6.1.2
    #         Safari (6.1.2), 51679K [recommended]
    #    - iCal-1.0.2
    #         iCal, 1.0.2, 6520K
    rexp = re.compile('(?m)^   [*|-] '
                      r'([^ ].*)[\r\n].*\(([^\)]+)')

    if salt.utils.is_true(recommended):
        # rexp parses lines that look like the following:
        #    * Safari6.1.2MountainLion-6.1.2
        #         Safari (6.1.2), 51679K [recommended]
        rexp = re.compile('(?m)^   [*] '
                          r'([^ ].*)[\r\n].*\(([^\)]+)')

    keys = ['name', 'version']
    _get = lambda l, k: l[keys.index(k)]

    updates = rexp.findall(out)

    ret = {}
    for line in updates:
        name = _get(line, 'name')
        version_num = _get(line, 'version')
        ret[name] = version_num

    if not salt.utils.is_true(restart):
        return ret

    # rexp parses lines that look like the following:
    #    * Safari6.1.2MountainLion-6.1.2
    #         Safari (6.1.2), 51679K [recommended] [restart]
    rexp1 = re.compile('(?m)^   [*|-] '
                       r'([^ ].*)[\r\n].*restart*')

    restart_updates = rexp1.findall(out)
    ret_restart = {}
    for update in ret:
        if update in restart_updates:
            ret_restart[update] = ret[update]

    return ret_restart
Return whether to refresh an item synchronously when it is missing from
dataset/ETHPy150Open saltstack/salt/salt/modules/mac_softwareupdate.py/_get_available--crossover with--dataset/ETHPy150Open codeinthehole/django-cacheback/cacheback/base.py/Job.should_missing_item_be_fetched_synchronously