Lots of Py3 compatibility changes. The core code is probably compatible. Py3 unittests failing because of unicode.