Python 3.4 compliance

Not fully tested, but have run all .py files in Python 3.4.