def analysis_dataset_config_for_message(analysis_dataset_configs, message):
    """
    Gets the analysis dataset configuration to use to process this message, by looking-up the configuration that refers
    to this message's engagement db "dataset" property.

    :param analysis_dataset_configs: Dataset configurations to search for the one that relates to the given message.
    :type analysis_dataset_configs: list of src.engagement_db_to_analysis.configuration.AnalysisDatasetConfiguration
    :param message: Message to retrieve the analysis dataset configuration for.
    :type message: engagement_database.data_models.Message
    :return: Analysis dataset configuration to use for this message.
    :rtype: src.engagement_db_to_analysis.configuration.AnalysisDatasetConfiguration
    """
    for config in analysis_dataset_configs:
        if message.dataset in config.engagement_db_datasets:
            return config
    raise ValueError(f"No analysis dataset configuration found for message '{message.message_id}', which has engagement"
                     f"db dataset {message.dataset}")