def deep_merge_dict(base, priority):
    if not isinstance(base, dict) or not isinstance(priority, dict):
        return priority
    result = copy.deepcopy(base)
    for key in priority.keys():
        if key in base:
            result[key] = deep_merge_dict(base[key], priority[key])
        else:
            result[key] = priority[key]
    return result