def flatten(dictionary, separator='<STR_LIT:.>', prefix='<STR_LIT>'):
new_dict = {}<EOL>for key, value in dictionary.items():<EOL><INDENT>new_key = prefix + separator + key if prefix else key<EOL>if isinstance(value, collections.MutableMapping):<EOL><INDENT>new_dict.update(flatten(value, separator, new_key))<EOL><DEDENT>elif isinstance(value, list):<EOL><INDENT>new_value = []<EOL>for item in value:<EOL><INDENT>if isinstance(item, collections.MutableMapping):<EOL><INDENT>new_value.append(flatten(item, separator, new_key))<EOL><DEDENT>else:<EOL><INDENT>new_value.append(item)<EOL><DEDENT><DEDENT>new_dict[new_key] = new_value<EOL><DEDENT>else:<EOL><INDENT>new_dict[new_key] = value<EOL><DEDENT><DEDENT>return new_dict<EOL>
Flatten the dictionary keys are separated by separator

    Arguments:
        dictionary {dict} -- The dictionary to be flattened.

    Keyword Arguments:
        separator {str} -- The separator to use (default is '.'). It will
        crush items with key conflicts.
        prefix {str} -- Used for recursive calls.

    Returns:
        dict -- The flattened dictionary.