code: def _is_stream_tty(stream):
      try:
          # TODO: check on windows if hasattr check would work correctly and
          # add value:
          return stream.isatty()
      except ValueError as exc:
          # Who knows why it is a ValueError, but let's try to be specific
          # If there is a problem with I/O - non-interactive, otherwise reraise
          if "I/O" in str(exc):
              return False
          raise
  
imports: import os
  import sys
  import tarfile
  import tempfile
  import timeit
  import os.path
  from glob import glob
  from datalad.utils import getpwd, get_tempfile_kwargs, rmtree
  from datalad.api import Dataset, create_test_dataset
label_desc: Use image node_id 1 for calling a global function with example usage: _is_stream_tty(stream) and returns: stream, False