code: def _diff_to_seq(X: Union[pd.Series, pd.DataFrame], lags: np.array):
      """Difference a series multiple times and return intermediate results.
  
      Parameters
      ----------
      X : pd.DataFrame
      lags : int or iterable of int, e.g., list of int
  
      Returns
      -------
      list, i-th element is _diff_transform(X, lags[0:i])
      """
      if X is None:
          return None
  
      if isinstance(lags, int):
          lags = [lags]
  
      ret = [X]
      Xd = X
      for lag in lags:
          # converting lag to int since pandas complains if it's np.int64
          Xd = Xd.diff(periods=int(lag))
          ret += [Xd]
      return ret
  
imports: from typing import Union
  import numpy
  import pandas
  from sklearn.utils import check_array
  from sktime.datatypes._utilities import get_cutoff, update_data
  from sktime.transformations.base import BaseTransformer
  from sktime.utils.validation import is_int
label_desc: Use image node_id 3 for calling a global function with example usage: _diff_to_seq(X, lags) and returns: ret, None