+def deep_update(to_update, update_with):
+ """
+ Update 'to_update' dict with the content 'update_with' dict recursively
+ :param to_update: must be a dictionary to be modified
+ :param update_with: must be a dictionary. It is not changed
+ :return: to_update
+ """
+ for key in update_with:
+ if key in to_update:
+ if isinstance(to_update[key], dict) and isinstance(update_with[key], dict):
+ deep_update(to_update[key], update_with[key])
+ continue
+ to_update[key] = deepcopy(update_with[key])
+ return to_update
+
+