Be Python 3 compatible

Not that anybody actually uses Python 3, but this helps very much with
finding obscure bugs.