Made gzipping python 3 compatible.
Fix python 3 unicode issues that were causing a failures in python3 tests.