def dict_deep_merge(a, b, path=None):
if path is None:<EOL><INDENT>path = []<EOL><DEDENT>for key in b:<EOL><INDENT>if key in a:<EOL><INDENT>if isinstance(a[key], dict) and isinstance(b[key], dict):<EOL><INDENT>dict_deep_merge(a[key], b[key], path + [str(key)])<EOL><DEDENT>elif a[key] == b[key]:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>a[key] = b[key]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>a[key] = b[key]<EOL><DEDENT><DEDENT>return a<EOL>
Deep-merge dictionary `b` into dictionary `a`.
    Kudos to http://stackoverflow.com/a/7205107/145400