def unflatten(flat_dict, separator='<STR_LIT:_>'):
_unflatten_asserts(flat_dict, separator)<EOL>unflattened_dict = dict()<EOL>def _unflatten(dic, keys, value):<EOL><INDENT>for key in keys[:-<NUM_LIT:1>]:<EOL><INDENT>dic = dic.setdefault(key, {})<EOL><DEDENT>dic[keys[-<NUM_LIT:1>]] = value<EOL><DEDENT>for item in flat_dict:<EOL><INDENT>_unflatten(unflattened_dict, item.split(separator), flat_dict[item])<EOL><DEDENT>return unflattened_dict<EOL>
Creates a hierarchical dictionary from a flattened dictionary
Assumes no lists are present
:param flat_dict: a dictionary with no hierarchy
:param separator: a string that separates keys
:return: a dictionary with hierarchy