Return a list of a specific type of item. The following items are available:

        vms
        runningvms
        ostypes
        hostdvds
        hostfloppies
        intnets
        bridgedifs
        hostonlyifs
        natnets
        dhcpservers
        hostinfo
        hostcpuids
        hddbackends
        hdds
        dvds
        floppies
        usbhost
        usbfilters
        systemproperties
        extpacks
        groups
        webcams
        screenshotformats

    CLI Example:

    .. code-block:: bash

        salt 'hypervisor' vboxmanage.items <item>
        salt 'hypervisor' vboxmanage.items <item> details=True
        salt 'hypervisor' vboxmanage.items <item> details=True group_by=Name

    Some items do not display well, or at all, unless ``details`` is set to
    ``True``. By default, items are grouped by the ``UUID`` field, but not all
    items contain that field. In those cases, another field must be specified.

def list_items(item, details=False, group_by='UUID'):
    '''
    Return a list of a specific type of item. The following items are available:

        vms
        runningvms
        ostypes
        hostdvds
        hostfloppies
        intnets
        bridgedifs
        hostonlyifs
        natnets
        dhcpservers
        hostinfo
        hostcpuids
        hddbackends
        hdds
        dvds
        floppies
        usbhost
        usbfilters
        systemproperties
        extpacks
        groups
        webcams
        screenshotformats

    CLI Example:

    .. code-block:: bash

        salt 'hypervisor' vboxmanage.items <item>
        salt 'hypervisor' vboxmanage.items <item> details=True
        salt 'hypervisor' vboxmanage.items <item> details=True group_by=Name

    Some items do not display well, or at all, unless ``details`` is set to
    ``True``. By default, items are grouped by the ``UUID`` field, but not all
    items contain that field. In those cases, another field must be specified.
    '''
    types = (
        'vms', 'runningvms', 'ostypes', 'hostdvds', 'hostfloppies', 'intnets',
        'bridgedifs', 'hostonlyifs', 'natnets', 'dhcpservers', 'hostinfo',
        'hostcpuids', 'hddbackends', 'hdds', 'dvds', 'floppies', 'usbhost',
        'usbfilters', 'systemproperties', 'extpacks', 'groups', 'webcams',
        'screenshotformats'
    )

    if item not in types:
        raise CommandExecutionError(
            'Item must be one of: {0}.'.format(', '.join(types))
        )

    flag = ''
    if details is True:
        flag = ' -l'

    ret = {}
    tmp_id = None
    tmp_dict = {}
    cmd = '{0} list{1} {2}'.format(vboxcmd(), flag, item)
    for line in salt.modules.cmdmod.run(cmd).splitlines():
        if not line.strip():
            continue
        comps = line.split(':')
        if not comps:
            continue
        if tmp_id is not None:
            ret[tmp_id] = tmp_dict
        line_val = ':'.join(comps[1:]).strip()
        if comps[0] == group_by:
            tmp_id = line_val
            tmp_dict = {}
        tmp_dict[comps[0]] = line_val
    return ret