SF patch# 1770008 by Christian Heimes (plus some extras).
Completely get rid of StringIO.py and cStringIO.c.

I had to fix a few tests and modules beyond what Christian did, and
invent a few conventions.  E.g. in elementtree, I chose to
write/return Unicode strings whe no encoding is given, but bytes when
an explicit encoding is given.  Also mimetools was made to always
assume binary files.
diff --git a/Lib/doctest.py b/Lib/doctest.py
index bc30a1a..0f40818 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -98,7 +98,7 @@
 import sys, traceback, inspect, linecache, os, re
 import unittest, difflib, pdb, tempfile
 import warnings
-from StringIO import StringIO
+from io import StringIO
 
 # There are 4 basic classes:
 #  - Example: a <source, want> pair, plus an intra-docstring line number.