Return block device attributes: UUID, LABEL, etc. This function only works
    on systems where blkid is available.

    device
        Device name from the system

    token
        Any valid token used for the search

    CLI Example:

    .. code-block:: bash

        salt '*' disk.blkid
        salt '*' disk.blkid /dev/sda
        salt '*' disk.blkid token='UUID=6a38ee5-7235-44e7-8b22-816a403bad5d'
        salt '*' disk.blkid token='TYPE=ext4'

def blkid(device=None, token=None):
    '''
    Return block device attributes: UUID, LABEL, etc. This function only works
    on systems where blkid is available.

    device
        Device name from the system

    token
        Any valid token used for the search

    CLI Example:

    .. code-block:: bash

        salt '*' disk.blkid
        salt '*' disk.blkid /dev/sda
        salt '*' disk.blkid token='UUID=6a38ee5-7235-44e7-8b22-816a403bad5d'
        salt '*' disk.blkid token='TYPE=ext4'
    '''
    cmd = ['blkid']
    if device:
        cmd.append(device)
    elif token:
        cmd.extend(['-t', token])

    ret = {}
    blkid_result = __salt__['cmd.run_all'](cmd, python_shell=False)

    if blkid_result['retcode'] > 0:
        return ret

    for line in blkid_result['stdout'].splitlines():
        if not line:
            continue
        comps = line.split()
        device = comps[0][:-1]
        info = {}
        device_attributes = re.split(('\"*\"'), line.partition(' ')[2])
        for key, value in zip(*[iter(device_attributes)]*2):
            key = key.strip('=').strip(' ')
            info[key] = value.strip('"')
        ret[device] = info

    return ret