Upgrading code into py3.