def merge_dicts(dict1, dict2):
    """
    Recursively merge two dictionaries.
    Lists are combined, dictionaries are recursively merged, other values are overwritten.
    """
    result = dict1.copy()
    for key, value in dict2.items():
        if key in result:
            if isinstance(result[key], dict) and isinstance(value, dict):
                result[key] = merge_dicts(result[key], value)
            elif isinstance(result[key], list) and isinstance(value, list):
                result[key].extend(value)
            else:
                result[key] = value
        else:
            result[key] = value
    return result

    Recursively merge two dictionaries.
    Lists are combined, dictionaries are recursively merged, other values are overwritten.
    
shared/json_config_merger.py