def mergeNestedDictionaries(dict1, dict2, copy=False, deepcopy=False):

    if copy:
        dict1 = copyModule.copy(dict1)
    elif deepcopy:
        dict1 = copyModule.deepcopy(dict1)
        
    for key, val in dict2.iteritems():
        if key in dict1 and isinstance(val, dict) and isinstance(dict1[key], dict):
            dict1[key] = mergeNestedDictionaries(dict1[key], val)
        else:
            dict1[key] = val
    return dict1
Recursively merge the values of dict2 into dict1.
dataset/ETHPy150Open binhex/moviegrabber/lib/site-packages/Cheetah/SettingsManager.py/mergeNestedDictionaries