Thanks Carl Meyer for the suggestion and Alex Gaynor and Carl for reviews.
Should be unneeded with Python 2.7 and up. Added some unicode_literals along the way.