Added assertStartsWith and assertEndsWith tests, and some nocover pragmas.
sort locals to make print order constant.
Added stringio to compat.
Fixed up tests to use regex, and stringio compat.
Renamed compat
Fixed remaining py3 compat issues.