simple python3 port to get rid of unicode errors.  unicode problems still exist in py2 version.