Changes to work on Python 3