code: def transform(self, X):
          '''
          Transforms the time series data based on the provided function. Note this transformation
          must not change the number of samples in the data.
  
          Parameters
          ----------
          X : array-like, shape [n_samples, ...]
              time series data and (optionally) contextual data
  
          Returns
          -------
          Xt : array-like, shape [n_samples, ...]
              transformed time series data
  
          '''
          if self.func is None:
              return X
          else:
              Xt, Xc = get_ts_data_parts(X)
              n_samples = len(Xt)
              Xt = self.func(Xt, **self.func_kwargs)
              if len(Xt) != n_samples:
                  raise ValueError("FunctionTransformer changes sample number (not supported).")
              if Xc is not None:
                  Xt = TS_Data(Xt, Xc)
              return Xf transform(self, X):
          '''
          Transforms the time series data based on the provided function. Note this transformation
          must not change the number of samples in the data.
  
          Parameters
          ----------
          X : array-like, shape [n_samples, ...]
              time series data and (optionally) contextual data
  
          Returns
          -------
          Xt : array-like, shape [n_samples, ...]
              transformed time series data
  
          '''
          if self.func is None:
              return X
          else:
              Xt, Xc = get_ts_data_parts(X)
              n_samples = len(Xt)
              Xt = self.func(Xt, **self.func_kwargs)
              if len(Xt) != n_samples:
                  raise ValueError("FunctionTransformer changes sample number (not supported).")
              if Xc is not None:
                  Xt = TS_Data(Xt, Xc)
              return Xt
docs: Transforms the time series data based on the provided function. Note this transformation
          must not change the number of samples in the data.
  
          Parameters
          ----------
          X : array-like, shape [n_samples, ...]
              time series data and (optionally) contextual data
  
          Returns
          -------
          Xt : array-like, shape [n_samples, ...]
              transformed time series data