code: def _check_series_length(
      series: TimeSeries,
      lags: Union[None, Sequence[int]],
      output_chunk_length: 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"
          )
          minimum_len = (
              -min(lags) + output_chunk_length
              if lags_specified
              else output_chunk_length
          )
      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:
          raise_if(
              series.n_timesteps < minimum_len,
              (
                  f"`{name}` must have at least "
                  f"`{minimum_len_str}` = {minimum_len} timesteps; "
                  f"instead, it only has {series.n_timesteps}."
              ),
          )
      return None
  
imports: import warnings
  from functools import reduce
  from math import inf
  from typing import Dict, List, Optional, Sequence, Tuple, Union
  from itertools import chain
  import numpy
  import pandas
  from numpy.lib.stride_tricks import as_strided
  from darts.logging import get_logger, raise_if, raise_if_not, raise_log
  from darts.timeseries import TimeSeries
  from darts.utils.utils import get_single_series, series2seq
label_desc: Use image node_id 17 for calling a global function with example usage: _check_series_length(series, lags, output_chunk_length, is_training, name) and returns: None