Converted to Python 3 using 2to3