Fixing python tools to work with python 2 and 3

Work on #5.