def parse_ipmi_fru(output):
    """Parse the output of the fru info retrieved with ipmitool"""
    hrdw = []

    sys_cls = None
    sys_type = None
    for line in output:
        if len(line.strip()) == 0:
            sys_cls = None
            sys_type = None
            continue

        items = line.split(':')
        if len(items) < 2:
            continue

        if line.startswith('FRU Device Description'):
            if 'Builtin FRU Device' in items[1]:
                sys_cls = 'oem'
            else:
                sys_cls = items[1].split('-FRU')[0].strip().lower()
                if sys_cls.startswith('psu'):
                    sys_type = sys_cls
                    sys_cls = 'psu'
        else:
            value = items[1].strip()
            sys_subtype = items[0].strip()
            if sys_type:
                hrdw.append((sys_cls, sys_type, sys_subtype, value))
            else:
                items = sys_subtype.split(' ')

                hrdw.append((sys_cls, items[0], ' '.join(items[1:]), value))

    return hrdw