NameRecord.__str__ returns a unicode string, but on Python2 the built-in str() expects a bytestring, therefore it raises UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128) We should probably change that as well.