def flatten(self, D):
if not isinstance(D, dict):<EOL><INDENT>return D<EOL><DEDENT>result = {}<EOL>for k,v in D.items():<EOL><INDENT>if isinstance(v, dict):<EOL><INDENT>for _k,_v in self.flatten(v).items():<EOL><INDENT>result['<STR_LIT:.>'.join([k,_k])] = _v<EOL><DEDENT><DEDENT>else:<EOL><INDENT>result[k] = v<EOL><DEDENT><DEDENT>return result<EOL>
flatten a nested dictionary D to a flat dictionary

        nested keys are separated by '.'