code: def _init_logger() -> None:
      """
      This function will (and should only) get invoked on the first time of importing nni (no matter which submodule).
      It will try to detect the running environment and setup logger accordingly.
  
      The detection should work in most cases but for `nnictl` and `nni.experiment`.
      They will be identified as "standalone" mode and must configure the logger by themselves.
      """
      # I think dispatcher and trial do not need colorful stdout.
      # Remove this when we finish refactor.
      # colorama.init()
  
      if dispatcher_env_vars.SDK_PROCESS == "dispatcher":
          _init_logger_dispatcher()
          return
  
      trial_platform = trial_env_vars.NNI_PLATFORM
  
      if trial_platform == "unittest":
          return
  
      if trial_platform and not trial_env_vars.REUSE_MODE:
          _init_logger_trial()
          return
  
      start_stdout_logging()
  
imports: from __future__ import annotations
  import logging
  import sys
  from datetime import datetime
  from io import TextIOBase
  from logging import FileHandler, Formatter, Handler, LogRecord, Logger, StreamHandler
  from pathlib import Path
  import string
  from typing import Optional
  import colorama
  from .env_vars import dispatcher_env_vars, trial_env_vars
label_desc: Use image node_id 6 for calling a global function with example usage: _init_logger() without return types