code: def log_stats(stats: LogStats, path: Optional[str]) -> None:
      """Helper function.
  
      :param stats: The statistics dictionary
      :param path: This can be a path-like string to organize the log into different sections.
      """
      for writer in GlobalLogState.global_log_stats_writers:
          writer.write(path, GlobalLogState.global_step, stats)
  
imports: from abc import ABC, abstractmethod
  from collections import defaultdict
  from enum import Enum
  from typing import Union, Callable, Dict, Optional, NamedTuple, List, Type, TypeVar, Tuple, Any
  import numpy
  from maze.core.events.event_record import EventRecord
  from maze.core.events.event_topic_factory import event_topic_factory
label_desc: Use image node_id 2 for calling a global function with example usage: log_stats(stats, path) without return types