Made the obvious changes to produce a common Python2 and Python3 code