Changed Python code to make it compatible with Python 3.