Python 3 compatibility fix for unicode