def helper_check_lagged_data(
        self,
        convert_lags_to_dict: bool,
        expected_X: np.ndarray,
        expected_y: np.ndarray,
        expected_times_x,
        expected_times_y,
        target: Optional[Union[TimeSeries, list[TimeSeries]]],
        past_cov: Optional[Union[TimeSeries, list[TimeSeries]]],
        future_cov: Optional[Union[TimeSeries, list[TimeSeries]]],
        lags: Optional[Union[list[int], dict[str, list[int]]]],
        lags_past: Optional[Union[list[int], dict[str, list[int]]]],
        lags_future: Optional[Union[list[int], dict[str, list[int]]]],
        output_chunk_length: int,
        output_chunk_shift: int,
        use_static_covariates: bool,
        multi_models: bool,
        max_samples_per_ts: Optional[int],
        use_moving_windows: bool,
        concatenate: bool,
        stride: int,
        **kwargs,
    ):
        """Helper function to call the `create_lagged_training_data()` method with lags argument either in the list
        format or the dictionary format (automatically convert them when they are identical across components).

        Assertions are different depending on the value of `concatenate` to account for the output shape.
        """
        if convert_lags_to_dict:
            lags_as_dict = self.convert_lags_to_dict(
                target,
                past_cov if lags_past else None,
                future_cov if lags_future else None,
                lags,
                lags_past,
                lags_future,
            )
            lags_ = lags_as_dict["target"]
            lags_past_ = lags_as_dict["past"]
            lags_future_ = lags_as_dict["future"]
        else:
            lags_ = lags
            lags_past_ = lags_past
            lags_future_ = lags_future

        # convert indexes to list of tuples to simplify processing
        expected_times_x = (
            expected_times_x
            if isinstance(expected_times_x, Sequence)
            else [expected_times_x]
        )
        expected_times_y = (
            expected_times_y
            if isinstance(expected_times_y, Sequence)
            else [expected_times_y]
        )

        X, y, times, _, _ = create_lagged_training_data(
            target_series=target,
            output_chunk_length=output_chunk_length,
            past_covariates=past_cov if lags_past_ else None,
            future_covariates=future_cov if lags_future_ else None,
            lags=lags_,
            lags_past_covariates=lags_past_,
            lags_future_covariates=lags_future_,
            uses_static_covariates=use_static_covariates,
            multi_models=multi_models,
            max_samples_per_ts=max_samples_per_ts,
            use_moving_windows=use_moving_windows,
            output_chunk_shift=output_chunk_shift,
            concatenate=concatenate,
            stride=stride,
        )
        # should have the exact same number of indexes
        assert len(times) == len(expected_times_x) == len(expected_times_y)

        # Check that time index(es) match:
        for time, exp_time in zip(times, expected_times_x):
            assert exp_time.equals(time)

        if concatenate:
            # Number of observations should match number of feature times:
            data_length = sum(len(time) for time in times)
            exp_length_x = sum(len(exp_time) for exp_time in expected_times_x)
            exp_length_y = sum(len(exp_time) for exp_time in expected_times_y)
            assert exp_length_x == exp_length_y
            assert X.shape[0] == exp_length_x == data_length
            assert y.shape[0] == exp_length_y == data_length

            # Check that outputs match:
            assert X.shape == expected_X.shape
            assert np.allclose(expected_X, X)
            assert y.shape == expected_y.shape
            assert np.allclose(expected_y, y)
        else:
            # Check the number of observation for each series
            for x_, exp_time_x, y_, exp_time_y, time in zip(
                X, expected_times_x, y, expected_times_y, times
            ):
                assert x_.shape[0] == len(time) == len(exp_time_x)
                assert y_.shape[0] == len(time) == len(exp_time_y)

            # Check that outputs match:
            for x_, y_ in zip(X, y):
                assert np.allclose(X, x_)
                assert np.allclose(y, y_)
Helper function to call the `create_lagged_training_data()` method with lags argument either in the list
        format or the dictionary format (automatically convert them when they are identical across components).

        Assertions are different depending on the value of `concatenate` to account for the output shape.
        
darts/tests/utils/tabularization/test_create_lagged_training_data.py