Clean out well-known bogus values.
    If it isn't clean (for example has value 'None'), return None.
    Otherwise, return the original value.

    NOTE: This logic also exists in the smbios module. This function is
          for use when not using smbios to retrieve the value.

def _clean_value(key, val):
    '''
    Clean out well-known bogus values.
    If it isn't clean (for example has value 'None'), return None.
    Otherwise, return the original value.

    NOTE: This logic also exists in the smbios module. This function is
          for use when not using smbios to retrieve the value.
    '''
    if (val is None or not val or
            re.match('none', val, flags=re.IGNORECASE)):
        return None
    elif 'uuid' in key:
        # Try each version (1-5) of RFC4122 to check if it's actually a UUID
        for uuidver in range(1, 5):
            try:
                uuid.UUID(val, version=uuidver)
                return val
            except ValueError:
                continue
        log.trace('HW %s value %s is an invalid UUID', key, val.replace('\n', ' '))
        return None
    elif re.search('serial|part|version', key):
        # 'To be filled by O.E.M.
        # 'Not applicable' etc.
        # 'Not specified' etc.
        # 0000000, 1234567 etc.
        # begone!
        if (re.match(r'^[0]+$', val) or
                re.match(r'[0]?1234567[8]?[9]?[0]?', val) or
                re.search(r'sernum|part[_-]?number|specified|filled|applicable', val, flags=re.IGNORECASE)):
            return None
    elif re.search('asset|manufacturer', key):
        # AssetTag0. Manufacturer04. Begone.
        if re.search(r'manufacturer|to be filled|available|asset|^no(ne|t)', val, flags=re.IGNORECASE):
            return None
    else:
        # map unspecified, undefined, unknown & whatever to None
        if (re.search(r'to be filled', val, flags=re.IGNORECASE) or
                re.search(r'un(known|specified)|no(t|ne)? (asset|provided|defined|available|present|specified)',
                    val, flags=re.IGNORECASE)):
            return None
    return val