in jcm/utils.py [0:0]
def flatten_dict(config):
"""Flatten a hierarchical dict to a simple dict."""
new_dict = {}
for key, value in config.items():
if isinstance(value, dict):
sub_dict = flatten_dict(value)
for subkey, subvalue in sub_dict.items():
new_dict[key + "/" + subkey] = subvalue
elif isinstance(value, tuple):
new_dict[key] = str(value)
else:
new_dict[key] = value
return new_dict