Port to Python 3

Script executes without any errors (Python 3.4).