def METHOD_NAME(
    config: Dict[str, Any],
    state: State,
) -> Dict[str, Any]:
    """Parses the provided DeepSpeed config for compatibility with the Mosaic trainer.
    Broadly speaking, this function does three things.
    1. Check for settings that are unsupported, like DeepSpeed optimizers.
    2. Check for inconsistencies between Mosaic trainer config and DeepSpeed config.
    3. Use Mosaic trainer config to fill in some defaults for DeepSpeed config.
    Args:
        config (Dict[str, Any]): The DeepSpeed config to use. Must follow the format specified
            in `DeepSpeed's documentation <https://www.deepspeed.ai/docs/config-json/>`_.
        state (State): The state of the trainer.
    Returns:
        Dict[str, Any]: The DeepSpeed config updated with values from the arguments passed to the
            :class:`.Trainer`.
    Raises:
        ValueError: If any of the values in the DeepSpeed config conflict with arguments passed
            to the trainer.
        RuntimeError: If the batch size of the train dataloader in the provided state is not set.
    """
    new_config = copy.deepcopy(config)
    _add_batch_config(new_config, state)
    _ensure_no_optim_in_config(new_config)
    _add_precision_config(new_config, state)
    if 'zero_allow_untested_optimizer' in new_config and not new_config['zero_allow_untested_optimizer']:
        warnings.warn(('Provided DeepSpeed configuration specifies zero_allow_untested_optimizer=False. '
                       'This causes DeepSpeed to reject certain Mosaic optimizers that are known to '
                       'work well with DeepSpeed.'))
    new_config['zero_allow_untested_optimizer'] = True
    return new_config