def _get_preprocessing_config(modality: Modality, media_download_headers: Optional[Dict[str, str]]):
    """
    Get the preprocessing config for the given modality used for searching.
    """
    if modality == Modality.TEXT:
        return TextPreprocessingConfig()  # the prefix has been added to the query, so we don't need to specify it here
    elif modality == Modality.IMAGE:
        return ImagePreprocessingConfig(download_header=media_download_headers, download_thread_count=1)
    elif modality == Modality.AUDIO:
        return AudioPreprocessingConfig(
            download_header=media_download_headers, download_thread_count=1,
            max_media_size_bytes=read_env_vars_and_defaults_ints(EnvVars.MARQO_MAX_SEARCH_VIDEO_AUDIO_FILE_SIZE)
        )
    elif modality == Modality.VIDEO:
        return VideoPreprocessingConfig(
            download_header=media_download_headers, download_thread_count=1,
            max_media_size_bytes=read_env_vars_and_defaults_ints(EnvVars.MARQO_MAX_SEARCH_VIDEO_AUDIO_FILE_SIZE)
        )
    else:
        raise InferenceError(f'Unsupported modality: {modality}')

    Get the preprocessing config for the given modality used for searching.
    
src/marqo/tensor_search/tensor_search.py