class_docstr: Dynamically wrap to sys.stdout.
  
  This makes packages that monkey-patch sys.stdout (e.g.doctest,
  sphinx-gallery) work properly.
class_docstr_tok: ["Dynamically","wrap","to","sys.stdout",".","This","makes","packages","that","monkey-patch","sys.stdout","(","e.g.doctest",",","sphinx-gallery",")","work","properly","."]
code: def __getattr__(self, name):  # noqa: D105
      # Even more ridiculous than this class, this must be sys.stdout (not
      # just stdout) in order for this to work (tested on OSX and Linux)
      if hasattr(sys.stdout, name):
          return getattr(sys.stdout, name)
      else:
          raise AttributeError(
              "'file' object has not attribute '%s'" % name
          )
  
imports: import contextlib
  import importlib
  import inspect
  import logging
  import os.path
  import re
  import sys
  import warnings
  from io import StringIO
  from typing import Any, Callable, TypeVar
  from decorator import FunctionMaker
  from .docs import fill_doc
label_desc: Use image node_id 1 for calling the WrapStdOut obj's underlying member method code with example usage: obj.__getattr__(name) and returns: getattr