References #7

Most of the python2 idioms for string handling removed.
While here, remove some dead code, specifically in tests.py.