Updated for Python3.