Unbreak some tests on Python 2
Try to make more tests pass on Python 3
Use a renormalizer to accept byte strings in doctest output
Ignore return value of write() of file objects on Python 3
Fix tests on Python 3 by ignoring pickle internals