Updated for Python 3.x and Python 2.7 compatibility

Changes account for running the script under Python 2.7 or Python 3.x including full Unicode support.  A few statements were also updated to reflect current Python 3 standards.  Tested with Python 2.7.3 and Python 3.3.2 under OSX and Python 2.7.5 and Python 3.3.2 under Windows.  It's a bit hackish, but it works.