More Python porting... All tests pass now!