Python3

Lots of changes from @Wooble and @dbs for python3 support using the six module.