Use StringIO to build strings more efficiently.

See this article for a performance comparison:
    http://www.skymind.com/~ocrow/python_string/

On the test suite, it does not make much of a performance difference,
but using this on large HTML files should be a little quicker (and take
less memory).  The string concatenation is effectively run at the
C level.
Avoid useless Python version check (io is in py27 now, too).
Merge pull request #14 from nvie/speed-up-string-building

Use StringIO to build strings more efficiently