Both x1 and x2 are bytestrings in Python 2. If you compare Unicode and bytes on Python 2; you also get False in this case:
>>> u'\xba\xba' == b'\xba\xba'
__main__:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
False
x1 is a Unicode string in Python 3.
You could add from __future__ import unicode_literals to make the code work the same on both Python 2 and 3:
>>> from __future__ import unicode_literals
>>> x1 = '\xab\xab'
>>> type(x1)
<type 'unicode'>
Don't mix bytestrings and Unicode strings.
To convert Unicode string to bytes:
bytestring = unicode_string.encode(character_encoding)
To convert bytes to Unicode string:
unicode_string = bytestring.decode(character_encoding)