class_docstr: A simple class to redirect stdout/err to file.
  
  Usage:
    with RedirectStream(sys.stdout, filename="stdout.txt"):
      print("commands will have stdout directed to file")
code: def __exit__(self, _, value, traceback):
      if self.disabled:
          return
      try:
          RedirectStream._flush_c_stream()  # ensures C stream buffer empty
          os.dup2(
              self.dup_stream, self.stream.fileno()
          )  # restores stream
          os.close(self.dup_stream)
          self.fd.close()
      except:  # pylint: disable=bare-except
          # TODO: redirect stream breaks in jupyter notebooks.
          #       This try except is a hacky workaround
          pass
  
file_path: kubric/kubric/redirect_io.py
imports: import ctypes
  import os
label_desc: Use image node_id 4 for calling the RedirectStream obj's underlying member method code with example usage: obj.__exit__(_, value, traceback) without return types