The third argument should really be a file-like object, rather than a `StringIO` object. Note that `sys.stdout` is a file and `StringIO.StringIO` is an object that behaves like a file, but really writes to a string buffer. I think this argument should be renamed to reflect this (how about `output_file`?) and the docstring should be changed to something like:

    * output_file:
        A :class:`file` or file-like object to receive output. Defaults to
        sys.stdout.