Compatibility with Python 2 & Python 3

This change makes the code run in both Py2/3.
Tested on Python 2.7.5 and 3.4.2.