Thanks Enrique Martínez for the report and @bmispelon for the tests.
Should be unneeded with Python 2.7 and up. Added some unicode_literals along the way.