Python 3 compatibility

Commit 728d5ae shouldn't be in here.