def flatten_dict(d, parent_key='<STR_LIT>', sep='<STR_LIT:.>',<EOL>ignore_under_prefixed=True, mark_value=True):
items = {}<EOL>for k in d:<EOL><INDENT>if ignore_under_prefixed and k.startswith('<STR_LIT>'):<EOL><INDENT>continue<EOL><DEDENT>v = d[k]<EOL>if mark_value and k.startswith('<STR_LIT:_>') and not k.startswith('<STR_LIT>'):<EOL><INDENT>v = MarkValue(repr(v))<EOL><DEDENT>new_key = sep.join((parent_key, k)) if parent_key else k<EOL>if isinstance(v, collections.MutableMapping):<EOL><INDENT>items.update(flatten_dict(v, new_key, sep=sep,<EOL>ignore_under_prefixed=True,<EOL>mark_value=True)<EOL>)<EOL><DEDENT>else:<EOL><INDENT>items[new_key] = v<EOL><DEDENT><DEDENT>return items<EOL>
>>> flatten_dict({"a": {"b": {"c": 1, "b": 2, "__d": 'ignore', "_e": "mark"} } })
{'a.b.b': 2, 'a.b.c': 1, 'a.b._e': "'mark'"}