def convert_lags_to_dict(ts_tg, ts_pc, ts_fc, lags_tg, lags_pc, lags_fc):
        """Convert lags to the dictionary format, assuming the lags are shared across the components"""
        lags_as_dict = dict()
        for ts_, lags_, name_ in zip(
            [ts_tg, ts_pc, ts_fc],
            [lags_tg, lags_pc, lags_fc],
            ["target", "past", "future"],
        ):
            single_ts = ts_[0] if isinstance(ts_, Sequence) else ts_
            if single_ts is None or lags_ is None:
                lags_as_dict[name_] = None
            # already in dict format
            elif isinstance(lags_, dict):
                lags_as_dict[name_] = lags_
            # from list
            elif isinstance(lags_, list):
                lags_as_dict[name_] = {c_name: lags_ for c_name in single_ts.components}
            else:
                raise ValueError(
                    f"Lags should be `None`, a list or a dictionary. Received {type(lags_)}."
                )
        return lags_as_dict
Convert lags to the dictionary format, assuming the lags are shared across the components
darts/tests/utils/tabularization/test_create_lagged_training_data.py