"""
    This class is like a StreamHandler using sys.stderr/stdout, but uses
    whatever sys.stderr/stderr 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.
    """
    def __init__(self, stream):
        if not isinstance(stream, str):
            raise Exception(
                "Cannot use file like objects. Use 'stdout' or 'stderr' as a str and without 'ext://'."
            )
        self._use_stderr = True
        if "stdout" in stream:
            self._use_stderr = False
            self._orig_stream = sys.stdout
        else:
            self._orig_stream = sys.stderr
        
        Handler.__init__(self)
    @property
    def stream(self):
        """Returns current stream."""
        if IS_K8S_EXECUTOR_POD:
            return self._orig_stream
        if self._use_stderr:
            return sys.stderr
        return sys.stdout
def set_context(logger, value):