Updated for Python 3

The current file only works for Python 2, this update will make the file work for both Python 2 & Python 3.