def merge_dicts(d1, d2):
    result = copy.deepcopy(d1)

    for key, value in six.iteritems(d2):
        if isinstance(value, dict):
            result[key] = merge_dicts(result[key], value)
        elif key not in result or value is not None:
            result[key] = value

    return result
Merge values from d2 into d1 ignoring empty / None values.
dataset/ETHPy150Open StackStorm/st2/st2client/st2client/utils/misc.py/merge_dicts