Added support for handling both python 2.x and 3.x