Compatibility with Python 3

Hi,
I use Python 3 so I have ported the codebase.
All tests pass on latests Python 2 and 3 stable release.