Don't hardcode sys.stdout at import time

This fixes a class of bugs that were found during doctest testing.

These functions all set a kwarg to a default of `sys.stdout`.  However, many tools, such as py.test or doctest replace sys.stdout with their own.  These functions will still use the `sys.stdout` defined at import time, not the "current" `sys.stdout` and thus subtle disappearance of output ensues.

This shouldn't affect the public API -- I consider it a bugfix.