Python 3 compatibility

This was a straightforward job as expected!