Fixed to run on Python versions 2 and 3