code: def _flat_type_map(ty, separator):
      typemap = {}
      for f in fields(ty):
          typemap[f.name] = f.type
          if is_hparam_type(f.type):
              nested = _flat_type_map(f.type, separator=separator)
          elif _is_union_type(f.type):
              nested = {}
              for ty_option in f.type.__args__:
                  if is_hparam_type(ty_option):
                      _update_disjoint(
                          nested,
                          _flat_type_map(
                              ty_option, separator=separator
                          ),
                      )
          else:
              nested = {}
          _update_disjoint(
              typemap,
              {f"{f.name}{separator}{k}": t for k, t in nested.items()},
          )
      return typemap
  
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 15 for calling a global function with example usage: _flat_type_map(ty, separator) and returns: typemap