class_docstr: Custom StreamHandler that uses current sys.stderr/stdout as the stream for logging.
  
  This class is like a StreamHandler using sys.stderr/stdout, but uses
  whatever sys.stderr/stdout is currently set to rather than the value of
  sys.stderr/stdout at handler construction time, except when running a
  task in a kubernetes executor pod.
class_docstr_tok: ["Custom","StreamHandler","that","uses","current","sys.stderr\/stdout","as","the","stream","for","logging",".","This","class","is","like","a","StreamHandler","using","sys.stderr\/stdout",",","but","uses","whatever","sys.stderr\/stdout","is","currently","set","to","rather","than","the","value","of","sys.stderr\/stdout","at","handler","construction","time",",","except","when","running","a","task","in","a","kubernetes","executor","pod","."]
docstr: Returns current stream.
docstr_tok: ["Returns","current","stream","."]
code: def stream(self):
      """Returns current stream."""
      from airflow.settings import (
          IS_EXECUTOR_CONTAINER,
          IS_K8S_EXECUTOR_POD,
      )
  
      if IS_K8S_EXECUTOR_POD or IS_EXECUTOR_CONTAINER:
          return self._orig_stream
      if self._use_stderr:
          return sys.stderr
  
      return sys.stdout
  
imports: from __future__ import annotations
  import abc
  import enum
  import logging
  import sys
  from io import IOBase
  from logging import Handler, StreamHandler
  from typing import IO, TYPE_CHECKING, Any, Optional, TypeVar, cast
  import re2
label_desc: Use image node_id 2 for calling the RedirectStdHandler obj's underlying member method code with example usage: obj.stream() and returns: sys, self, sys