Support python3

This changes make it possible to run the module on Python 3.x, while still supporting Python 2.x