updated script to work with Python 3

script was written in 2011 and no longer compiled in python 3
updated syntax to work in python34