def decode_name(name):
    name_length = ord(name[0])
    assert (name_length == 32)
    decoded_name = re.sub('..', _do_first_level_decoding, name[1:33])
    if (name[33] == '\x00'):
        return (34, decoded_name, '')
    else:
        decoded_domain = ''
        offset = 34
        while 1:
            domain_length = ord(name[offset])
            if (domain_length == 0):
                break
            decoded_domain = ('.' + name[offset:(offset + domain_length)])
            offset += domain_length
        return ((offset + 1), decoded_name, decoded_domain)
def decode_name(name):
    name_length = ord(name[0])
    assert (name_length == 32)
    decoded_name = re.sub('..', _do_first_level_decoding, name[1:33])
    if (name[33] == '\x00'):
        return (34, decoded_name, )
    else:
        decoded_domain = 
        offset = 34
        while 1:
            domain_length = ord(name[offset])
            if (domain_length == 0):
                break
            decoded_domain = ('.' + name[offset:(offset + domain_length)])
            offset += domain_length
        return ((offset + 1), decoded_name, decoded_domain)