code: def create_nested_dict(
      flat_dict: Dict[str, Union[float, str]]
  ) -> ModelConfigDict:
      """Generate a nested dict out of a flat dict whose keys are delimited by a delimiter character.
  
      Args:
          flat_dict: potential generated baseline config. Here's an example of what it could look like:
  
              trainer.batch_size: 324
              trainer.learning_rate: 0.0635
  
          The expected output would be
  
              trainer:
                  batch_size: 324
                  learning_rate: 0.0635
      """
  
      def to_nested_format(
          parameter_name: str,
          value: Union[str, int, float],
          delimiter: str = ".",
      ) -> Dict[str, Any]:
          # https://stackoverflow.com/a/40401961
          split_parameter_name = parameter_name.split(delimiter)
          for parameter_name_or_section in reversed(
              split_parameter_name
          ):
              value = {parameter_name_or_section: value}
          return value
  
      config = {}
      for parameter_name_or_section in flat_dict:
          config = merge_dict(
              config,
              to_nested_format(
                  parameter_name_or_section,
                  copy.deepcopy(flat_dict[parameter_name_or_section]),
              ),
          )
      return config
  
imports: import copy
  import random
  from collections import deque, namedtuple
  from typing import Any, Deque, Dict, List, Tuple, Union
  import pandas
  from ludwig.config_sampling.parameter_sampling import handle_property_type, ParameterBaseTypes
  from ludwig.constants import SEQUENCE, TEXT, TIMESERIES
  from ludwig.data.dataset_synthesizer import build_synthetic_dataset_df
  from ludwig.schema.model_types.base import ModelConfig
  from ludwig.types import ModelConfigDict
  from ludwig.utils.misc_utils import merge_dict
label_desc: Use image node_id 7 for calling a global function with example usage: create_nested_dict(flat_dict) and returns: config, value