def ts_fit(
            series: Union[TimeSeries, Sequence[TimeSeries]],
            params: Mapping[str, Any],
            **kwargs,
        ):
            """
            'Fits' transform by computing time-average of each sample and
            component in `series`.

            If `global_fit` is `True`, then `series` is a `Sequence[TimeSeries]` and the time-averaged mean
            of each component over *all* of the `TimeSeries` is computed. If `global_fit` is `False`, then
            `series` is a single `TimeSeries` and the time-averaged mean of the components of this single
            `TimeSeries` are computed.
            """
            if not isinstance(series, Sequence):
                series = [series]
            vals = np.concatenate([ts.all_values(copy=False) for ts in series], axis=0)
            return np.mean(vals, axis=0)

            'Fits' transform by computing time-average of each sample and
            component in `series`.

            If `global_fit` is `True`, then `series` is a `Sequence[TimeSeries]` and the time-averaged mean
            of each component over *all* of the `TimeSeries` is computed. If `global_fit` is `False`, then
            `series` is a single `TimeSeries` and the time-averaged mean of the components of this single
            `TimeSeries` are computed.
            
darts/tests/dataprocessing/transformers/test_invertible_fittable_data_transformer.py