code: def get_stats_logger(path: Optional[str] = None) -> LogStatsConsumer:
      """
      Creates an object that can be used to pipe LogStatAggregator instances with the logging writers.
  
      Example usage:
      >>> logger = get_stats_logger("eval")
      >>> aggregator = LogStatsAggregator(LogStatsLevel.STEP, logger)
      >>> aggregator.reduce() # calculate the statistics and sent it to the registered logging writers
  
      :param path: The optional path to prefix the logging tags
      :return:
      """
      return LogStatsLogger(path)
  
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 4 for calling a global function with example usage: get_stats_logger(path) and returns: LogStatsLogger