def _check_series_length(
    series: TimeSeries,
    lags: Union[None, Sequence[int]],
    output_chunk_length: int,
    output_chunk_shift: int,
    is_training: bool,
    name: Literal["target_series", "past_covariates", "future_covariates"],
) -> None:
    """
    Throws `ValueError` if `series` is too short for specified `lags` and, when `is_training`, `output_chunk_length`.
    """
    is_target = name == "target_series"
    is_label_series = is_training and is_target
    lags_specified = lags is not None
    minimum_len, minimum_len_str = None, None
    if is_label_series:
        minimum_len_str = (
            "-min(lags) + output_chunk_length"
            if lags_specified
            else "output_chunk_length"
        ) + " + output_chunk_shift"
        minimum_len = (
            output_chunk_length
            + output_chunk_shift
            + (-min(lags) if lags_specified else 0)
        )
    elif lags_specified:
        lags_name = "lags" if name == "target_series" else f"lags_{name}"
        minimum_len_str = f"-min({lags_name}) + max({lags_name}) + 1"
        minimum_len = -min(lags) + max(lags) + 1
    if lags_specified:
        if series.n_timesteps < minimum_len:
            raise_log(
                ValueError(
                    f"`{name}` must have at least `{minimum_len_str}` = {minimum_len} time "
                    f"steps; instead, it only has {series.n_timesteps}."
                ),
                logger=logger,
            )
    return None

    Throws `ValueError` if `series` is too short for specified `lags` and, when `is_training`, `output_chunk_length`.
    
darts/utils/data/tabularization/tabularization.py