python 2to3 changes

Being the python noob I am, I've only really put this through 2to3 and given it a test out in python 3.4 and 2.7 but seems to be working ok in both. The changes all look to be pretty minor in reality so I'm hoping this will be safe to merge in.