.. versionadded:: 2019.2.0

    Add an inventory item to an existing device.

    device_name
        The name of the device, e.g., ``edge_router``.
    item_name
        String of inventory item name, e.g., ``Transceiver``.

    manufacturer_name
        String of inventory item manufacturer, e.g., ``Fiberstore``.

    serial
        String of inventory item serial, e.g., ``FS1238931``.

    part_id
        String of inventory item part id, e.g., ``740-01234``.

    description
        String of inventory item description, e.g., ``SFP+-10G-LR``.

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_inventory_item edge_router Transceiver part_id=740-01234

def create_inventory_item(device_name,
                          item_name,
                          manufacturer_name=None,
                          serial='',
                          part_id='',
                          description=''):
    '''
    .. versionadded:: 2019.2.0

    Add an inventory item to an existing device.

    device_name
        The name of the device, e.g., ``edge_router``.
    item_name
        String of inventory item name, e.g., ``Transceiver``.

    manufacturer_name
        String of inventory item manufacturer, e.g., ``Fiberstore``.

    serial
        String of inventory item serial, e.g., ``FS1238931``.

    part_id
        String of inventory item part id, e.g., ``740-01234``.

    description
        String of inventory item description, e.g., ``SFP+-10G-LR``.

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_inventory_item edge_router Transceiver part_id=740-01234
    '''
    nb_device = get_('dcim', 'devices', name=device_name)
    if not nb_device:
        return False
    if manufacturer_name:
        nb_man = get_('dcim', 'manufacturers', name=manufacturer_name)
        if not nb_man:
            create_manufacturer(manufacturer_name)
            nb_man = get_('dcim', 'manufacturers', name=manufacturer_name)
    payload = {'device': nb_device['id'], 'name': item_name, 'description': description, 'serial': serial,
               'part_id': part_id, 'parent': None}
    if manufacturer_name:
        payload['manufacturer'] = nb_man['id']
    done = _add('dcim', 'inventory-items', payload)
    if done:
        return {'dcim': {'inventory-items': payload}}
    else:
        return done