docstr: Determines which output stream (stdout, stderr, or custom) to use
docstr_tok: ["Determines","which","output","stream","(","stdout",",","stderr",",","or","custom",")","to","use"]
code: def _check_stream(self):
      """Determines which output stream (stdout, stderr, or custom) to use"""
      if self.stream:
          try:
              supported = "PYCHARM_HOSTED" in os.environ or os.isatty(
                  sys.stdout.fileno()
              )
  
          # a fix for IPython notebook "IOStream has no fileno."
          except UnsupportedOperation:
              supported = True
  
          else:
              if self.stream is not None and hasattr(
                  self.stream, "write"
              ):
                  self._stream_out = self.stream.write
                  self._stream_flush = self.stream.flush
  
          if supported:
              if self.stream == 1:
                  self._stream_out = sys.stdout.write
                  self._stream_flush = sys.stdout.flush
              elif self.stream == 2:
                  self._stream_out = sys.stderr.write
                  self._stream_flush = sys.stderr.flush
          else:
              if self.stream is not None and hasattr(
                  self.stream, "write"
              ):
                  self._stream_out = self.stream.write
                  self._stream_flush = self.stream.flush
              else:
                  print("Warning: No valid output stream.")
  
imports: import os
  import sys
  import time
  from io import UnsupportedOperation
label_desc: Use image node_id 4 for calling the Prog obj's underlying member method code with example usage: obj._check_stream() without return types