code: def prepare_global_logging(serialization_dir, file_friendly_logging):
      """
      This function configures 3 global logging attributes - streaming stdout and stderr
      to a file as well as the terminal, setting the formatting for the python logging
      library and setting the interval frequency for the Tqdm progress bar.
  
      Note that this function does not set the logging level, which is set in ``allennlp/run.py``.
  
      Parameters
      ----------
      serializezation_dir : ``str``, required.
          The directory to stream logs to.
      file_friendly_logging : ``bool``, required.
          Whether logs should clean the output to prevent carridge returns
          (used to update progress bars on a single terminal line).
      """
      Tqdm.set_slower_interval(file_friendly_logging)
      std_out_file = os.path.join(serialization_dir, "stdout.log")
      sys.stdout = TeeLogger(
          std_out_file,  # type: ignore
          sys.stdout,
          file_friendly_logging,
      )
      sys.stderr = TeeLogger(
          os.path.join(serialization_dir, "stderr.log"),  # type: ignore
          sys.stderr,
          file_friendly_logging,
      )
  
      stdout_handler = logging.FileHandler(std_out_file)
      stdout_handler.setFormatter(
          logging.Formatter(
              "%(asctime)s - %(levelname)s - %(name)s - %(message)s"
          )
      )
      logging.getLogger().addHandler(stdout_handler)
  
imports: from __future__ import division
  from __future__ import absolute_import
  import importlib
  import logging
  import pkgutil
  import random
  import subprocess
  import sys
  import os
  import torch
  import numpy
  import spacy
  from spacy.cli.download import download
  from spacy.language import Language
  import allennlp
  from allennlp.common.checks import log_pytorch_version_info
  from allennlp.common.params import Params
  from allennlp.common.tqdm import Tqdm
  from allennlp.common.tee_logger import TeeLogger
label_desc: Use image node_id 8 for calling a global function with example usage: prepare_global_logging(serialization_dir, file_friendly_logging) without return types