def flatten_haiku_tree(haiku_dict):
  """Flattens a haiku parameter tree into a flat dictionary."""
  out = {}
  for module in haiku_dict.keys():
    out_module = module.replace('/~/', '.').replace('/', '.')
    for key in haiku_dict[module]:
      out_key = f'{out_module}.{key}'
      out[out_key] = haiku_dict[module][key]
  return out