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 __enter__(self):
      if self.disabled:
          return
      try:
          self.stream.flush()  # ensures python stream unaffected
          self.fd = open(
              self.filename, "w+", encoding="utf-8"
          )  # pylint: disable=consider-using-with
          self.dup_stream = os.dup(self.stream.fileno())
          os.dup2(
              self.fd.fileno(), self.stream.fileno()
          )  # replaces stream
      except Exception as e:  # pylint: disable=broad-except
          # TODO: redirect stream breaks in jupyter notebooks.
          #       This try except is a hacky workaround
          print(e)
  
file_path: kubric/kubric/redirect_io.py
imports: import ctypes
  import os
label_desc: Use image node_id 3 for calling the RedirectStream obj's underlying member method code with example usage: obj.__enter__() without return types