Python 3 compatibility

Turned out to be a fairly simple job as expected!