code: def redirect_output_to_file(stdout_file_path, stderr_file_path):
      """Redirect stdout (e.g., `print`) and stderr (e.g., `warning/error`) to given files respectively.
  
      Args:
          stdout_file_path: Path of the file to output the stdout.
          stderr_file_path: Path of the file to output the stderr.
  
      Example:
      >>> print('test')
      test
      >>> with redirect_output_to_file('stdout.log', 'stderr.log'):
      ...     print('test')  # Output nothing, `test` is printed to `stdout.log`.
      >>> print('test')
      test
      """
  
      origin_stdout = sys.stdout
      origin_stderr = sys.stderr
  
      stdout_f = open(stdout_file_path, "a")
      stderr_f = open(stderr_file_path, "a")
  
      sys.stdout = stdout_f
      sys.stderr = stderr_f
  
      # NOTE: we should add the handler after executing the above code.
      handler = logger.add_stdout_handler()
  
      try:
          yield
      finally:
          sys.stdout = origin_stdout
          sys.stderr = origin_stderr
  
          stdout_f.close()
          stderr_f.close()
  
          logger.remove_handler(handler)
  
file_path: PARL/parl/remote/utils.py
imports: import cloudpickle
  import sys
  import inspect
  from contextlib import contextmanager
  import os
  import pkg_resources
  from parl.utils import logger
label_desc: Use image node_id 1 for calling a global function with example usage: redirect_output_to_file(stdout_file_path, stderr_file_path) without return types