Writing unicode to stdout

Reliably writing unicode to stdout is actually a bit fiddly, with things trying to automatically detect encodings, and the differences between Python 2 and 3. This function returns a wrapper for sys.stdout/stderr that accepts unicode.

Using it in `nbconvert.writers.stdout` fixes #4578, at least for me.