(a, b, path=None, update=True)
return a
Merge two dictionaries recursively.

    From https://stackoverflow.com/a/7205107
Merge two dictionaries recursively.
Merge two dictionaries recursively .
def _merge_dictionaries(a, b, path=None, update=True):
    """
    Merge two dictionaries recursively.

    From https://stackoverflow.com/a/7205107
    """
    if path is None:
        path = []
    for key in b:
        if key in a:
            if isinstance(a[key], dict) and isinstance(b[key], dict):
                _merge_dictionaries(a[key], b[key], path + [str(key)])
            elif a[key] == b[key]:
                pass  # same leaf value
            elif update:
                a[key] = b[key]
            else:
                raise Exception("Conflict at %s" % ".".join(path + [str(key)]))
        else:
            a[key] = b[key]
    return a
def _merge_dictionaries ( a , b , path = None , update = True ) : if path is None : path = [ ] for key in b : if key in a : if isinstance ( a [ key ] , dict ) and isinstance ( b [ key ] , dict ) : _merge_dictionaries ( a [ key ] , b [ key ] , path + [ str ( key ) ] ) elif a [ key ] == b [ key ] : pass # same leaf value elif update : a [ key ] = b [ key ] else : raise Exception ( "Conflict at %s" % "." . join ( path + [ str ( key ) ] ) ) else : a [ key ] = b [ key ] return a