def helper_compare_encoded_covs_with_ref(
        model, ts, covariates, n, ocl, multi_model
    ):
        """checks that covariates generated by encoders fulfill the requirements compared to some
        reference covariates:
        What has to match:
        - the types should match, i.e., past and / or future covariates
        - same number of covariate TimeSeries in the list/sequence
        - generated/encoded covariates at training time must have the same start time as reference
        - generated/encoded covariates at prediction time must have the same end time as reference
        """

        def generate_expected_times(ts, n_predict=0) -> dict:
            """generates expected start and end times for the corresponding covariates."""
            freq = ts[0].freq

            def to_ts(dt):
                return pd.Timestamp(dt)

            def train_start_end(start_base, end_base):
                start = to_ts(start_base) - int(not multi_model) * (ocl - 1) * freq
                if not n_predict:
                    end = to_ts(end_base) - (ocl - 1) * freq
                else:
                    end = to_ts(end_base) + freq * max(n_predict - ocl, 0)
                return start, end

            if not n_predict:
                # expected train start, and end
                pc1_start, pc1_end = train_start_end("1999-11-01", "2000-11-01")
                pc2_start, pc2_end = train_start_end("2000-11-01", "2001-11-01")
                fc1_start, fc1_end = train_start_end("2000-03-01", "2001-04-01")
                fc2_start, fc2_end = train_start_end("2001-03-01", "2002-04-01")
            else:
                # expected inference start, and end
                pc1_start, pc1_end = train_start_end("2000-09-01", "2000-12-01")
                pc2_start, pc2_end = train_start_end("2001-09-01", "2001-12-01")
                fc1_start, fc1_end = train_start_end("2001-01-01", "2001-05-01")
                fc2_start, fc2_end = train_start_end("2002-01-01", "2002-05-01")

            times = {
                "pc_start": [pc1_start, pc2_start],
                "pc_end": [pc1_end, pc2_end],
                "fc_start": [fc1_start, fc2_start],
                "fc_end": [fc1_end, fc2_end],
            }
            return times

        covs_reference = (
            covariates.get("past_covariates"),
            covariates.get("future_covariates"),
        )
        covs_generated_train = model.encoders.encode_train(target=ts)
        covs_generated_infer = model.encoders.encode_inference(n=n, target=ts)

        refer_past, refer_future = covs_reference[0], covs_reference[1]
        train_past, train_future = covs_generated_train[0], covs_generated_train[1]
        infer_past, infer_future = covs_generated_infer[0], covs_generated_infer[1]

        t_train = generate_expected_times(ts)
        t_infer = generate_expected_times(ts, n_predict=n)
        if train_past is None:
            assert infer_past is None and refer_past is None
        else:
            assert all([
                isinstance(el, list) for el in [train_past, infer_past, refer_past]
            ])
            assert len(train_past) == len(infer_past) == len(refer_past)
            assert all([
                t_p.start_time() == tp_s
                for t_p, tp_s in zip(train_past, t_train["pc_start"])
            ])
            assert all([
                t_p.end_time() == tp_e
                for t_p, tp_e in zip(train_past, t_train["pc_end"])
            ])
            assert all([
                i_p.start_time() == ip_s
                for i_p, ip_s in zip(infer_past, t_infer["pc_start"])
            ])
            assert all([
                i_p.end_time() == ip_e
                for i_p, ip_e in zip(infer_past, t_infer["pc_end"])
            ])

        if train_future is None:
            assert infer_future is None and refer_future is None
        else:
            assert all([
                isinstance(el, list)
                for el in [train_future, infer_future, refer_future]
            ])
            assert len(train_future) == len(infer_future) == len(refer_future)
            assert all([
                t_f.start_time() == tf_s
                for t_f, tf_s in zip(train_future, t_train["fc_start"])
            ])
            assert all([
                t_f.end_time() == tf_e
                for t_f, tf_e in zip(train_future, t_train["fc_end"])
            ])
            assert all([
                i_f.start_time() == if_s
                for i_f, if_s in zip(infer_future, t_infer["fc_start"])
            ])
            assert all([
                i_f.end_time() == if_e
                for i_f, if_e in zip(infer_future, t_infer["fc_end"])
            ])
checks that covariates generated by encoders fulfill the requirements compared to some
        reference covariates:
        What has to match:
        - the types should match, i.e., past and / or future covariates
        - same number of covariate TimeSeries in the list/sequence
        - generated/encoded covariates at training time must have the same start time as reference
        - generated/encoded covariates at prediction time must have the same end time as reference
        
darts/tests/models/forecasting/test_sklearn_models.py