<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def models_max_input_output_length(models: List[InferenceModel], num_stds: int, forced_max_input_len: Optional[int] = None, forced_max_output_len: Optional[int] = None) -> Tuple[int, Callable]: """ Returns a function to compute maximum output length given a fixed number of standard deviations as a safety margin, and the current input length. Mean and std are taken from the model with the largest values to allow proper ensembling of models trained on different data sets. :param models: List of models. :param num_stds: Number of standard deviations to add as a safety margin. If -1, returned maximum output lengths will always be 2 * input_length. :param forced_max_input_len: An optional overwrite of the maximum input length. :param forced_max_output_len: An optional overwrite of the maximum output length. :return: The maximum input length and a function to get the output length given the input length. """

    max_mean = max(model.length_ratio_mean for model in models)
    max_std = max(model.length_ratio_std for model in models)

    supported_max_seq_len_source = min((model.max_supported_seq_len_source for model in models
                                        if model.max_supported_seq_len_source is not None),
                                       default=None)
    supported_max_seq_len_target = min((model.max_supported_seq_len_target for model in models
                                        if model.max_supported_seq_len_target is not None),
                                       default=None)
    training_max_seq_len_source = min(model.training_max_seq_len_source for model in models)

    return get_max_input_output_length(supported_max_seq_len_source,
                                       supported_max_seq_len_target,
                                       training_max_seq_len_source,
                                       length_ratio_mean=max_mean,
                                       length_ratio_std=max_std,
                                       num_stds=num_stds,
                                       forced_max_input_len=forced_max_input_len,
                                       forced_max_output_len=forced_max_output_len)