def _check_lags(
    lags: Optional[Union[Sequence[int], dict[str, list[int]]]],
    lags_past_covariates: Optional[Union[Sequence[int], dict[str, list[int]]]],
    lags_future_covariates: Optional[Union[Sequence[int], dict[str, list[int]]]],
) -> None:
    """
    Throws `ValueError` if any `lag` values aren't negative OR if no lags have been specified.
    """
    all_lags = [lags, lags_past_covariates, lags_future_covariates]
    suffixes = ["", "_past_covariates", "_future_covariates"]
    lags_is_none = []
    for i, (suffix, lags_i) in enumerate(zip(suffixes, all_lags)):
        lags_is_none.append(lags_i is None)
        if not lags_is_none[-1]:
            is_target_or_past = i < 2
            max_lag = -1 if is_target_or_past else inf

            if isinstance(lags_i, dict):
                lags_i = list(set(chain(*lags_i.values())))

            if any((lag > max_lag or not isinstance(lag, int)) for lag in lags_i):
                raise_log(
                    ValueError(
                        f"`lags{suffix}` must be a `Sequence` or `Dict` containing only `int` "
                        f"values less than {max_lag + 1}."
                    ),
                    logger=logger,
                )

    if all(lags_is_none):
        raise_log(
            ValueError(
                "Must specify at least one of: `lags`, `lags_past_covariates`, `lags_future_covariates`."
            ),
            logger=logger,
        )
    return None

    Throws `ValueError` if any `lag` values aren't negative OR if no lags have been specified.
    
darts/utils/data/tabularization/tabularization.py