code: def __init__(self, stream, fallback=None):
      warn(
          "IOStream is deprecated since IPython 5.0, use sys.{stdin,stdout,stderr} instead",
          DeprecationWarning,
          stacklevel=2,
      )
      if not hasattr(stream, "write") or not hasattr(stream, "flush"):
          if fallback is not None:
              stream = fallback
          else:
              raise ValueError("fallback required, but not specified")
      self.stream = stream
      self._swrite = stream.write
  
      # clone all methods not overridden:
      def clone(meth):
          return not hasattr(self, meth) and not meth.startswith("_")
  
      for meth in filter(clone, dir(stream)):
          try:
              val = getattr(stream, meth)
          except AttributeError:
              pass
          else:
              setattr(self, meth, val)
  
imports: from __future__ import print_function
  from __future__ import absolute_import
  import atexit
  import os
  import sys
  import tempfile
  import warnings
  from warnings import warn
  from IPython.utils.decorators import undoc
  from .capture import CapturedIO, capture_output
  from .py3compat import string_types, input, PY3
label_desc: Use image node_id 1 to create a new IOStream object  with example: obj = IOStream(stream, fallback)