def _cleanse_wwn(wwn_type, wwn):
    """
    Some wwns may have alternate text representations. Adjust to our
    preferred representation.
    """
    wwn = str(wwn.strip()).lower()
    if wwn_type in ('naa', 'eui', 'ib'):
        if wwn.startswith('0x'):
            wwn = wwn[2:]
        wwn = wwn.replace('-', '')
        wwn = wwn.replace(':', '')
        if not (wwn.startswith('naa.') or wwn.startswith('eui.') or wwn.
            startswith('ib.')):
            wwn = wwn_type + '.' + wwn
    return wwn
