updated all code and test cases to run on python 2 and 3.