code: def flat_to_nested(flat_dict, separator="."):
      nested_dict = dict()
      for k, v in flat_dict.items():
          parts = k.split(separator)
          d = nested_dict
          subkey = None
          for part in parts[:-1]:
              subkey = (
                  part if subkey is None else subkey + separator + part
              )
              if part not in d:
                  d[part] = dict()
              if not isinstance(d[part], dict):
                  raise ValueError(
                      f"Set conflicting values for {subkey}"
                  )
              d = d[part]
          if parts[-1] in d:
              raise ValueError(f"Set conflicting values for {k}")
          d[parts[-1]] = v
      return nested_dict
  
imports: import typing
  from dataclasses import fields, is_dataclass
  from functools import lru_cache
  from typeguard import check_type
label_desc: Use image node_id 12 for calling a global function with example usage: flat_to_nested(flat_dict, separator) and returns: nested_dict