code: def get_log_stream(logger):
      
  
      file_stream = None
      log_stream = None
      for handler in logger.handlers:
          if isinstance(handler, logging.FileHandler):
              file_stream = handler.stream
          else:
              log_stream = handler.stream
  
      if file_stream:
          return file_stream
  
      return log_stream
docs: Returns a stream to the root log file.
      If there is no logfile return the stderr log stream
  
      Returns:
          A stream to the root log file or stderr stream.