def _insert_azureml_client(config, azureml_client):
    """Insert azureml_client into config recursively.

    Valid cases:
        1. AzureML resource path config without azureml_client
        2. AzureML system config without azureml_client_config
    config is modified in place.
    """
    if not isinstance(config, (dict, list)):
        return

    insert_key, config_type = _needs_aml_client(config)

    if insert_key and not azureml_client:
        raise ValueError(f"azureml_client is required for {config_type} but not provided.")
    elif insert_key:
        set_nested_dict_value(config, insert_key, azureml_client)
        return

    for value in config.values() if isinstance(config, dict) else config:
        _insert_azureml_client(value, azureml_client)
Insert azureml_client into config recursively.

    Valid cases:
        1. AzureML resource path config without azureml_client
        2. AzureML system config without azureml_client_config
    config is modified in place.
    
olive/workflows/run/config.py