Porting to Python 3

Port to Python 3.x using 2to3.py