WIP: More Python 3 fixes

This is a work in progress, and I am aiming to try and get the test suite to pass in Python 3.