code: def configure_log_file(out_file, err_file):
      # If either of the file handles are None, there are no log files to
      # configure since we're redirecting all output to stdout and stderr.
      if out_file is None or err_file is None:
          return
      stdout_fileno = sys.stdout.fileno()
      stderr_fileno = sys.stderr.fileno()
      # C++ logging requires redirecting the stdout file descriptor. Note that
      # dup2 will automatically close the old file descriptor before overriding
      # it.
      os.dup2(out_file.fileno(), stdout_fileno)
      os.dup2(err_file.fileno(), stderr_fileno)
      # We also manually set sys.stdout and sys.stderr because that seems to
      # have an effect on the output buffering. Without doing this, stdout
      # and stderr are heavily buffered resulting in seemingly lost logging
      # statements. We never want to close the stdout file descriptor, dup2 will
      # close it when necessary and we don't want python's GC to close it.
      sys.stdout = ray._private.utils.open_log(
          stdout_fileno, unbuffered=True, closefd=False
      )
      sys.stderr = ray._private.utils.open_log(
          stderr_fileno, unbuffered=True, closefd=False
      )
  
imports: import colorama
  from dataclasses import dataclass
  import logging
  import os
  import re
  import sys
  import threading
  import time
  from typing import Callable, Dict, List, Set, Tuple, Any, Optional
  import ray
  from ray.experimental.tqdm_ray import RAY_TQDM_MAGIC
  from ray._private.ray_constants import RAY_DEDUP_LOGS, RAY_DEDUP_LOGS_AGG_WINDOW_S, RAY_DEDUP_LOGS_ALLOW_REGEX, RAY_DEDUP_LOGS_SKIP_REGEX
  from ray.util.debug import log_once
label_desc: Use image node_id 5 for calling a global function with example usage: configure_log_file(out_file, err_file) without return types