code: def flatten(
      struc_dict: Dict[str, Any], parent_key: str = "", sep: str = "."
  ) -> Dict[str, Union[str, int, float]]:
      """Flatten the given dict such that keys are concatenated by the given sep parameter
  
      :param struc_dict: The structured dictionary to be flattened.
      :param parent_key: The key of the parent dict value.
      :param sep: The separator to use for concatenating the keys.
  
      :return: The flattened dict.
      """
      items = []
      for k, v in struc_dict.items():
          new_key = parent_key + sep + k if parent_key else k
          if isinstance(v, dict):
              items.extend(flatten(v, new_key, sep=sep).items())
          elif isinstance(v, list):
              items.append((new_key, str(list(v))))
          elif isinstance(v, (str, float, int)):
              items.append((new_key, v))
          elif v is None:
              items.append((new_key, v))
          else:
              raise ValueError(
                  f"Unexpected value type found: {type(v), v}"
              )
      return dict(items)
  
file_path: maze/maze/core/log_stats/hparam_writer_tensorboard.py
imports: import glob
  import os
  from typing import List, Union, Dict, Any, Callable, Tuple
  import numpy
  import yaml
  from torch.utils.tensorboard import SummaryWriter
  from maze.utils.bcolors import BColors
  from maze.utils.tensorboard_reader import tensorboard_to_pandas
label_desc: Use image node_id 1 for calling a global function with example usage: flatten(struc_dict, parent_key, sep) and returns: dict