Single codebase Python 3 support (again)

This is mostly working - there are a couple of failures in the js tests, and I'm having trouble running the parallel tests on Python 2. I have to run home, but will carry on in the morning.