code: def configure_logging_and_warnings(
      log_level: Optional[int] = None,
      logging_config_file: Optional[Text] = None,
      warn_only_once: bool = True,
      filter_repeated_logs: bool = True,
  ) -> None:
      """Sets log levels of various loggers and sets up filters for warnings and logs.
  
      Args:
          log_level: The log level to be used for the 'Rasa' logger. Pass `None` to use
              either the environment variable 'LOG_LEVEL' if it is specified, or the
              default log level otherwise.
          logging_config_file: YAML file containing logging configuration to handle
              custom formatting
          warn_only_once: determines whether user warnings should be filtered by the
              `warnings` module to appear only "once"
          filter_repeated_logs: determines whether `RepeatedLogFilter`s are added to
              the handlers of the root logger
      """
      if logging_config_file is not None:
          configure_logging_from_file(logging_config_file)
  
      if (
          log_level is None
      ):  # Log level NOTSET is 0 so we use `is None` here
          log_level_name = os.environ.get(
              ENV_LOG_LEVEL, DEFAULT_LOG_LEVEL
          )
          # Change log level from str to int (note that log_level in function parameter
          # int already, coming from CLI argparse parameter).
          log_level = logging.getLevelName(log_level_name)
  
      logging.getLogger("rasa").setLevel(log_level)
      # Assign log level to env variable in str format (not int). Why do we assign?
      os.environ[ENV_LOG_LEVEL] = logging.getLevelName(log_level)
  
      configure_library_logging()
  
      if filter_repeated_logs:
          for handler in logging.getLogger().handlers:
              handler.addFilter(RepeatedLogFilter())
  
      _filter_warnings(
          log_level=log_level, warn_only_once=warn_only_once
      )
  
imports: import copy
  import inspect
  import logging
  import logging.config
  import logging.handlers
  import os
  import shutil
  import tempfile
  import warnings
  from pathlib import Path
  from types import TracebackType
  from typing import Any, Coroutine, Dict, List, Optional, Text, Type, TypeVar, Union, ContextManager, Set, Tuple
  from socket import SOCK_DGRAM, SOCK_STREAM
  import numpy
  import rasa.utils.io
  from rasa.constants import DEFAULT_LOG_LEVEL_LIBRARIES, ENV_LOG_LEVEL_LIBRARIES, ENV_LOG_LEVEL_MATPLOTLIB, ENV_LOG_LEVEL_RABBITMQ, ENV_LOG_LEVEL_KAFKA
  from rasa.shared.constants import DEFAULT_LOG_LEVEL, ENV_LOG_LEVEL, TCP_PROTOCOL
  from rasa.shared.exceptions import RasaException
  import rasa.shared.utils.io
label_desc: Use image node_id 5 for calling a global function with example usage: configure_logging_and_warnings(log_level, logging_config_file, warn_only_once, filter_repeated_logs) without return types