class_docstr: Complements the event system by providing aggregation functionality. How the events are aggregated
  is specified by the event interface decorators (see event_decorators.py).
  
  Note that the statistics calculation for episode aggregators will automatically be
  triggered on every `increment_log_step()` call.
class_docstr_tok: ["Complements","the","event","system","by","providing","aggregation","functionality",".","How","the","events","are","aggregated","is","specified","by","the","event","interface","decorators","(","see","event_decorators.py",")",".","Note","that","the","statistics","calculation","for","episode","aggregators","will","automatically","be","triggered","on","every","`","increment_log_step","(",")","`","call","."]
docstr: Unwrap single attributes (events with just one value) from the dictionary. Return the dict as is if it
  contains more than one attribute.
docstr_tok: ["Unwrap","single","attributes","(","events","with","just","one","value",")","from","the","dictionary",".","Return","the","dict","as","is","if","it","contains","more","than","one","attribute","."]
code: def _flatten_single_attribute(
      cls,
      attributes: Dict[str, Any],
      group_by_list: Optional[List[str]],
  ) -> Union[Dict[str, Any], Any]:
      """Unwrap single attributes (events with just one value) from the dictionary. Return the dict as is if it
      contains more than one attribute."""
      if group_by_list:
          attributes_minus_group = attributes.copy()
          for group_by in group_by_list:
              attributes_minus_group.pop(group_by)
  
          return cls._flatten_single_attribute(
              attributes_minus_group, None
          )
  
      if len(attributes) == 1:
          return next(iter(attributes.values()))
  
      return attributes
  
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 11 for calling the LogStatsAggregator obj's underlying member method code with example usage: obj._flatten_single_attribute(cls, attributes, group_by_list) and returns: attributes, cls, next