Encoding aware for python 2