code: def flatten_dict(
      d: t.MutableMapping[str, t.Any],
      parent: str = "",
      sep: str = ".",
  ) -> t.Generator[tuple[str, t.Any], None, None]:
      """Flatten nested dictionary into a single level dictionary."""
      for k, v in d.items():
          k = f'"{k}"' if any(i in punctuation for i in k) else k
          nkey = parent + sep + k if parent else k
          if isinstance(v, t.MutableMapping):
              yield from flatten_dict(
                  t.cast(t.MutableMapping[str, t.Any], v),
                  parent=nkey,
                  sep=sep,
              )
          else:
              yield nkey, v
  
imports: from __future__ import annotations
  import ipaddress
  import logging
  import os
  import re
  import typing
  from functools import singledispatch
  from typing import TYPE_CHECKING
  import schema
  import yaml
  from ...exceptions import BentoMLConfigException
  from ..utils import LazyLoader
label_desc: Use image node_id 5 for calling a global function with example usage: flatten_dict(d, parent, sep) without return types