Py3k-friendly use of StringIO. Remove unused imports.

This was done manually. Note that Python 2.7 has an io.StringIO class, but it's strictly Python3-compatible and deals in Unicode strings instead of bytes, so I preferred the classic cStringIO implementation for Python 2.

For the modules where StringIO was imported but not used, I just pruned them.