updated for python 2.x or 3.x

will run with either code now without error