Issue #783: python3 compatible - merge

I don't want to mess with rebase, so I merged python 3 compatibility changes from gh-1234 to a new branch.   This PR is ready for review, but I plan to fix remaining python 3 test failures and incorporate six.py soon so that #783 can be closed once this is pulled.