code: def create_logger(
      name: str,
      level: Optional[int] = None,
      format: Optional[str] = None,
      time_format: Optional[str] = None,
      file: Optional[Path] = None,
  ) -> logging.Logger:
      """Setups a logger and their handlers.
  
      To change the default values, alter the global variables above.
  
      Parameters
      ----------
      name : str
          Name for the logger.
      level : int , optional
          Logging level (e.g. debug, info.). If none, default is used.
      format : str, optional
          Format of logging message. If none, default is used.
      time_format : str, optional
          Format of timestamps. If none, default is used (global variable).
      file : Path, optional
          Path to logging file. If none, default is used.
      Returns
      -------
      logging.Logger
          The requested logger.
      """
      # check if logger already exists, return if it does.
      if name in logging.root.manager.loggerDict:
          return logging.getLogger(name)
  
      # logging level
      level = level if level else defaults.default_level
  
      # logging format
      format = format if format else defaults.default_logging_format
      time_format = (
          time_format if time_format else defaults.default_time_format
      )
  
      formatter = logging.Formatter(format, time_format)
  
      # logging file
      file = file if file else defaults.default_file
  
      logger = logging.getLogger(name=name)
      logger.setLevel(level)
  
      # Add stream handler (stdout) to logger
      stdout_handler = logging.StreamHandler(sys.stdout)
      stdout_handler.setFormatter(formatter)
      stdout_handler.setLevel(level)
      logger.addHandler(stdout_handler)
  
      # add file handler if requested
      if file:
          file.parent.mkdir(parents=True, exist_ok=True)
          file_handler = logging.FileHandler(file)
          file_handler.setFormatter(formatter)
          file_handler.setLevel(level)
          logger.addHandler(file_handler)
  
      return logger
  
file_path: aequitas/src/aequitas/fairflow/utils/logging.py
imports: import logging
  import sys
  from pathlib import Path
  from typing import Optional
label_desc: Use image node_id 1 for calling a global function with example usage: create_logger(name, level, format, time_format, file) and returns: logger, logging