Python3 compatible branch

All tests passing, seems fully working.