Python 3 compatibility

For everyone interested in my Python 2.7/3.3+ compatibility fork. To have a central place for comparing and discussing the code. See #1506 for the history of this fork.