Use Python 2 /3 compatible source

This PR changes some code to be simultaneously Python 2 / 3 compatible.
This allows us to turn `2to3` off in `setup.py` which makes development with Python 3 a bit more pleasant.