modify for Python 3