Reverted code to python2