Okay, this version works on Python versions 2.6 through 3.3 both in the
context of our test suite, and in real console use both using the
vanilla interpreter and IPython, though I'm sure there are still
exceptions.

One problem I ran into is that our `FakeTTY` class that we use in some
of our tests actually behaves sensibly in the face of unicode strings,
whereas the real `sys.stdout` does not, at least not on Python 2.6.

Most of the stuff in the `except UnicodeEncodeError`  block is only needed on
2.6, but there's no reason to explicitly make that check.  Finally,
there's no explicit check against bytes on Python 3, but if someone
passes in a bytes object it will blow up eventually anyways so I'm fine
with that for now.