Fixed compatibility with Python 3.x
Merged changes from:
https://github.com/machalekj/google/commit/b3d19af9729ae7ad12fb442151950f57c77b8a38