def catalog_resource(resource, inventory):
    """
    Catalogs a resource for the inventory list

    Args:
        resource: The resource to catalog
        inventory: The inventory list to update
    """
    for item in inventory:
        if item['Uri'] == resource['@odata.id']:
            return
    resource_type = resource['@odata.type'].rsplit('.')[-1]
    location_prop = 'Location'
    if resource_type == 'Drive':
        location_prop = 'PhysicalLocation'
    catalog = {'Uri': resource['@odata.id'], 'PartNumber': resource.get(
        'PartNumber', None), 'SerialNumber': resource.get('SerialNumber',
        None), 'Manufacturer': resource.get('Manufacturer', None), 'Model':
        resource.get('Model', None), 'SKU': resource.get('SKU', None),
        'AssetTag': resource.get('AssetTag', None), 'Label': resource.get(
        location_prop, {}).get('PartLocation', {}).get('ServiceLabel', None
        ), 'State': resource.get('Status', {}).get('State', None),
        'Description': None}
    if catalog['Label'] is None:
        catalog['Label'] = resource_type + ': ' + resource['Id']
    prop_list = []
    if resource_type == 'Chassis':
        prop_list = ['Model']
    elif resource_type == 'Processor':
        if catalog['Model'] is not None:
            prop_list = ['Model']
        else:
            prop_list = ['Manufacturer', 'ProcessorArchitecture',
                'ProcessorType', 'TotalCores', 'MaxSpeedMHz']
    elif resource_type == 'Memory':
        prop_list = ['Manufacturer', 'CapacityMiB', 'MemoryDeviceType',
            'MemoryType']
    elif resource_type == 'Drive':
        prop_list = ['Manufacturer', 'CapacityBytes', 'Protocol', 'MediaType']
    elif resource_type == 'PCIeDevice':
        prop_list = ['Manufacturer', 'Model']
    elif resource_type == 'StorageController':
        prop_list = ['Manufacturer', 'SpeedGbps', 'SupportedDeviceProtocols']
    elif resource_type == 'NetworkAdapter':
        prop_list = ['Manufacturer', 'Model']
    if catalog['State'] != 'Absent':
        description_str = ''
        for prop in prop_list:
            if resource.get(prop, None) is not None:
                prop_val = resource[prop]
                if prop == 'TotalCores':
                    prop_val = str(prop_val) + ' Cores'
                elif prop == 'MaxSpeedMHz':
                    prop_val = '@ ' + str(prop_val) + 'MHz'
                elif prop == 'CapacityMiB':
                    prop_val = str(prop_val) + 'MB'
                elif prop == 'CapacityBytes':
                    prop_val = str(int(prop_val / 2 ** 30)) + 'GB'
                elif prop == 'SpeedGbps':
                    prop_val = str(prop_val) + 'Gbps'
                elif prop == 'SupportedDeviceProtocols':
                    prop_val = '/'.join(prop_val) + ' Controller'
                description_str = description_str + ' ' + prop_val
            elif prop == 'MediaType':
                description_str = description_str + ' Drive'
            elif prop == 'SupportedDeviceProtocols':
                description_str = description_str + ' Storage Controller'
        catalog['Description'] = description_str.strip()
    inventory.append(catalog)
