[python3] Fix use of xrange (c.f. #157)
[python3] More python3 fixes (c.f. #157)