Port to Python 3

Unfortunately probably not backwards compatible, but this lets us use ST3.