def get_item_detail(name, cataloglist, vers='', skip_min_os_check=False, suppress_warnings=False):
    "Searches the catalogs in list for an item matching the given name that\n    can be installed on the current hardware/OS (optionally skipping the\n    minimum OS check so we can return an item that requires a higher OS)\n\n    If no version is supplied, but the version is appended to the name\n    ('TextWrangler--2.3.0.0.0') that version is used.\n    If no version is given at all, the latest version is assumed.\n    Returns a pkginfo item, or None.\n    "
    rejected_items = []
    machine = info.getMachineFacts()

    def munki_version_ok(item):
        'Returns a boolean to indicate if the current Munki version is high\n        enough to install this item. If not, also adds the failure reason to\n        the rejected_items list.'
        if item.get('minimum_munki_version'):
            min_munki_vers = item['minimum_munki_version']
            display.display_debug1('Considering item %s, version %s with minimum Munki version required %s', item['name'], item['version'], min_munki_vers)
            display.display_debug1('Our Munki version is %s', machine['munki_version'])
            if (pkgutils.MunkiLooseVersion(machine['munki_version']) < pkgutils.MunkiLooseVersion(min_munki_vers)):
                reason = ('Rejected item %s, version %s with minimum Munki version required %s. Our Munki version is %s.' % (item['name'], item['version'], item['minimum_munki_version'], machine['munki_version']))
                rejected_items.append(reason)
                return False
        return True

    def os_version_ok(item, skip_min_os_check=False):
        'Returns a boolean to indicate if the item is ok to install under\n        the current OS. If not, also adds the failure reason to the\n        rejected_items list. If skip_min_os_check is True, skips the minimum os\n        version check.'
        if (item.get('minimum_os_version') and (not skip_min_os_check)):
            min_os_vers = item['minimum_os_version']
            display.display_debug1('Considering item %s, version %s with minimum os version required %s', item['name'], item['version'], min_os_vers)
            display.display_debug1('Our OS version is %s', machine['os_vers'])
            if (pkgutils.MunkiLooseVersion(machine['os_vers']) < pkgutils.MunkiLooseVersion(min_os_vers)):
                reason = ('Rejected item %s, version %s with minimum os version required %s. Our OS version is %s.' % (item['name'], item['version'], item['minimum_os_version'], machine['os_vers']))
                rejected_items.append(reason)
                return False
        if item.get('maximum_os_version'):
            max_os_vers = item['maximum_os_version']
            display.display_debug1('Considering item %s, version %s with maximum os version supported %s', item['name'], item['version'], max_os_vers)
            display.display_debug1('Our OS version is %s', machine['os_vers'])
            if (pkgutils.MunkiLooseVersion(machine['os_vers']) > pkgutils.MunkiLooseVersion(max_os_vers)):
                reason = ('Rejected item %s, version %s with maximum os version required %s. Our OS version is %s.' % (item['name'], item['version'], item['maximum_os_version'], machine['os_vers']))
                rejected_items.append(reason)
                return False
        return True

    def cpu_arch_ok(item):
        'Returns a boolean to indicate if the item is ok to install under\n        the current CPU architecture. If not, also adds the failure reason to\n        the rejected_items list.'
        if item.get('supported_architectures'):
            display.display_debug1('Considering item %s, version %s with supported architectures: %s', item['name'], item['version'], item['supported_architectures'])
            display.display_debug1('Our architecture is %s', machine['arch'])
            if (machine['arch'] in item['supported_architectures']):
                return True
            if (('x86_64' in item['supported_architectures']) and (machine['arch'] == 'i386') and (machine['x86_64_capable'] is True)):
                return True
            reason = ('Rejected item %s, version %s with supported architectures: %s. Our architecture is %s.' % (item['name'], item['version'], item['supported_architectures'], machine['arch']))
            rejected_items.append(reason)
            return False
        return True

    def installable_condition_ok(item):
        'Returns a boolean to indicate if an installable_condition predicate\n        in the current item passes. If not, also adds the failure reason to\n        the rejected_items list.'
        if item.get('installable_condition'):
            if (not info.predicate_evaluates_as_true(item['installable_condition'])):
                rejected_items.append(('Rejected item %s, version %s with installable_condition: %s.' % (item['name'], item['version'], item['installable_condition'])))
                return False
        return True
    if (vers == 'apple_update_metadata'):
        vers = 'latest'
    else:
        (name, includedversion) = split_name_and_version(name)
        if (includedversion and (vers == '')):
            vers = includedversion
        if vers:
            vers = pkgutils.trim_version_string(vers)
        else:
            vers = 'latest'
    if skip_min_os_check:
        display.display_debug1('Looking for detail for: %s, version %s, ignoring minimum_os_version...', name, vers)
    else:
        display.display_debug1('Looking for detail for: %s, version %s...', name, vers)
    for catalogname in cataloglist:
        if ((catalogname in _CATALOG) and (name in _CATALOG[catalogname]['named'])):
            itemsmatchingname = _CATALOG[catalogname]['named'][name]
            indexlist = []
            if (vers == 'latest'):
                versionlist = list(itemsmatchingname.keys())
                versionlist.sort(key=pkgutils.MunkiLooseVersion, reverse=True)
                for versionkey in versionlist:
                    indexlist.extend(itemsmatchingname[versionkey])
            elif (vers in list(itemsmatchingname.keys())):
                indexlist = itemsmatchingname[vers]
            if indexlist:
                display.display_debug1(('Considering %s items with name %s from catalog %s' % (len(indexlist), name, catalogname)))
            for index in indexlist:
                item = _CATALOG[catalogname]['items'][index]
                if (munki_version_ok(item) and os_version_ok(item, skip_min_os_check=skip_min_os_check) and cpu_arch_ok(item) and installable_condition_ok(item)):
                    display.display_debug1('Found %s, version %s in catalog %s', item['name'], item['version'], catalogname)
                    return item
    display.display_debug1('Not found')
    for reason in rejected_items:
        if suppress_warnings:
            display.display_debug1(reason)
        else:
            display.display_warning(reason)
    return None
Searches the catalogs in list for an item matching the given name that
can be installed on the current hardware/OS (optionally skipping the
minimum OS check so we can return an item that requires a higher OS)

If no version is supplied, but the version is appended to the name
('TextWrangler--2.3.0.0.0') that version is used.
If no version is given at all, the latest version is assumed.
Returns a pkginfo item, or None.
def get_item_detail(name, cataloglist, vers=, skip_min_os_check=False, suppress_warnings=False):
    "Searches the catalogs in list for an item matching the given name that\n    can be installed on the current hardware/OS (optionally skipping the\n    minimum OS check so we can return an item that requires a higher OS)\n\n    If no version is supplied, but the version is appended to the name\n    ('TextWrangler--2.3.0.0.0') that version is used.\n    If no version is given at all, the latest version is assumed.\n    Returns a pkginfo item, or None.\n    "
    rejected_items = []
    machine = info.getMachineFacts()

    def munki_version_ok(item):
        'Returns a boolean to indicate if the current Munki version is high\n        enough to install this item. If not, also adds the failure reason to\n        the rejected_items list.'
        if item.get('minimum_munki_version'):
            min_munki_vers = item['minimum_munki_version']
            display.display_debug1('Considering item %s, version %s with minimum Munki version required %s', item['name'], item['version'], min_munki_vers)
            display.display_debug1('Our Munki version is %s', machine['munki_version'])
            if (pkgutils.MunkiLooseVersion(machine['munki_version']) < pkgutils.MunkiLooseVersion(min_munki_vers)):
                reason = ('Rejected item %s, version %s with minimum Munki version required %s. Our Munki version is %s.' % (item['name'], item['version'], item['minimum_munki_version'], machine['munki_version']))
                rejected_items.append(reason)
                return False
        return True

    def os_version_ok(item, skip_min_os_check=False):
        'Returns a boolean to indicate if the item is ok to install under\n        the current OS. If not, also adds the failure reason to the\n        rejected_items list. If skip_min_os_check is True, skips the minimum os\n        version check.'
        if (item.get('minimum_os_version') and (not skip_min_os_check)):
            min_os_vers = item['minimum_os_version']
            display.display_debug1('Considering item %s, version %s with minimum os version required %s', item['name'], item['version'], min_os_vers)
            display.display_debug1('Our OS version is %s', machine['os_vers'])
            if (pkgutils.MunkiLooseVersion(machine['os_vers']) < pkgutils.MunkiLooseVersion(min_os_vers)):
                reason = ('Rejected item %s, version %s with minimum os version required %s. Our OS version is %s.' % (item['name'], item['version'], item['minimum_os_version'], machine['os_vers']))
                rejected_items.append(reason)
                return False
        if item.get('maximum_os_version'):
            max_os_vers = item['maximum_os_version']
            display.display_debug1('Considering item %s, version %s with maximum os version supported %s', item['name'], item['version'], max_os_vers)
            display.display_debug1('Our OS version is %s', machine['os_vers'])
            if (pkgutils.MunkiLooseVersion(machine['os_vers']) > pkgutils.MunkiLooseVersion(max_os_vers)):
                reason = ('Rejected item %s, version %s with maximum os version required %s. Our OS version is %s.' % (item['name'], item['version'], item['maximum_os_version'], machine['os_vers']))
                rejected_items.append(reason)
                return False
        return True

    def cpu_arch_ok(item):
        'Returns a boolean to indicate if the item is ok to install under\n        the current CPU architecture. If not, also adds the failure reason to\n        the rejected_items list.'
        if item.get('supported_architectures'):
            display.display_debug1('Considering item %s, version %s with supported architectures: %s', item['name'], item['version'], item['supported_architectures'])
            display.display_debug1('Our architecture is %s', machine['arch'])
            if (machine['arch'] in item['supported_architectures']):
                return True
            if (('x86_64' in item['supported_architectures']) and (machine['arch'] == 'i386') and (machine['x86_64_capable'] is True)):
                return True
            reason = ('Rejected item %s, version %s with supported architectures: %s. Our architecture is %s.' % (item['name'], item['version'], item['supported_architectures'], machine['arch']))
            rejected_items.append(reason)
            return False
        return True

    def installable_condition_ok(item):
        'Returns a boolean to indicate if an installable_condition predicate\n        in the current item passes. If not, also adds the failure reason to\n        the rejected_items list.'
        if item.get('installable_condition'):
            if (not info.predicate_evaluates_as_true(item['installable_condition'])):
                rejected_items.append(('Rejected item %s, version %s with installable_condition: %s.' % (item['name'], item['version'], item['installable_condition'])))
                return False
        return True
    if (vers == 'apple_update_metadata'):
        vers = 'latest'
    else:
        (name, includedversion) = split_name_and_version(name)
        if (includedversion and (vers == )):
            vers = includedversion
        if vers:
            vers = pkgutils.trim_version_string(vers)
        else:
            vers = 'latest'
    if skip_min_os_check:
        display.display_debug1('Looking for detail for: %s, version %s, ignoring minimum_os_version...', name, vers)
    else:
        display.display_debug1('Looking for detail for: %s, version %s...', name, vers)
    for catalogname in cataloglist:
        if ((catalogname in _CATALOG) and (name in _CATALOG[catalogname]['named'])):
            itemsmatchingname = _CATALOG[catalogname]['named'][name]
            indexlist = []
            if (vers == 'latest'):
                versionlist = list(itemsmatchingname.keys())
                versionlist.sort(key=pkgutils.MunkiLooseVersion, reverse=True)
                for versionkey in versionlist:
                    indexlist.extend(itemsmatchingname[versionkey])
            elif (vers in list(itemsmatchingname.keys())):
                indexlist = itemsmatchingname[vers]
            if indexlist:
                display.display_debug1(('Considering %s items with name %s from catalog %s' % (len(indexlist), name, catalogname)))
            for index in indexlist:
                item = _CATALOG[catalogname]['items'][index]
                if (munki_version_ok(item) and os_version_ok(item, skip_min_os_check=skip_min_os_check) and cpu_arch_ok(item) and installable_condition_ok(item)):
                    display.display_debug1('Found %s, version %s in catalog %s', item['name'], item['version'], catalogname)
                    return item
    display.display_debug1('Not found')
    for reason in rejected_items:
        if suppress_warnings:
            display.display_debug1(reason)
        else:
            display.display_warning(reason)
    return None