Updated version for Python 3