unicode hardening for python 2