rearranging the code base for python2 and 3