

def parse_dmidecode(type):
    'Parses `dmidecode` output.\n\n    :param type: A string with type of entity to display.\n\n    :returns: A list with dictionaries of entities for specified type.\n    '
    output = utils.execute('dmidecode', '-q', '--type', type)
    lines = output[0].split('\n')
    info = []
    multiline_values = None
    section = 0
    for line in lines:
        if ((len(line) != 0) and (len(line.strip()) == len(line))):
            info.append({
                
            })
            section = (len(info) - 1)
        try:
            (k, v) = (l.strip() for l in line.split(':', 1))
        except ValueError:
            k = line.strip()
            if (not k):
                multiline_values = None
            if multiline_values:
                info[section][multiline_values].append(k)
        else:
            if (not v):
                multiline_values = k.lower()
                info[section][multiline_values] = []
            else:
                info[section][k.lower()] = v
    return info

dataset/ETHPy150Open openstack/bareon/bareon/utils/hardware.py parse_dmidecode/original