def deep_update(d, u):
    """
    Perform deep merge / update of the target dict.
    """

    for k, v in six.iteritems(u):
        if isinstance(v, Mapping):
            r = deep_update(d.get(k, {}), v)
            d[k] = r
        else:
            d[k] = u[k]

    return d

    Perform deep merge / update of the target dict.
    
st2common/st2common/util/misc.py