docs: def roll_time_series(df_or_dict, column_id, column_sort, column_kind, rolling_direction, max_timeshift=None):
      """
      This method creates sub windows of the time series. It rolls the (sorted) data frames for each kind and each id
      separately in the "time" domain (which is represented by the sort order of the sort column given by `column_sort`).
  
      For each rolling step, a new id is created by the scheme "id={id}, shift={shift}", here id is the former id of the
      column and shift is the amount of "time" shifts.
  
      A few remarks:
  
       * This method will create new IDs!
       * The sign of rolling defines the direction of time rolling, a positive value means we are going back in time
       * It is possible to shift time series of different lengths but
       * We assume that the time series are uniformly sampled
       * For more information, please see :ref:`forecasting-label`.
  
      :param df_or_dict: a pandas DataFrame or a dictionary. The required shape/form of the object depends on the rest of
          the passed arguments.
      :type df_or_dict: pandas.DataFrame or dict
      :param column_id: it must be present in the pandas DataFrame or in all DataFrames in the dictionary.
          It is not allowed to have NaN values in this column.
      :type column_id: basestring or None
      :param column_sort: if not None, sort the rows by this column. It is not allowed to
          have NaN values in this column.
      :type column_sort: basestring or None
      :param column_kind: It can only be used when passing a pandas DataFrame (the dictionary is already assumed to be
          grouped by the kind). Is must be present in the DataFrame and no NaN values are allowed.
          If the kind column is not passed, it is assumed that each column in the pandas DataFrame (except the id or
          sort column) is a possible kind.
      :type column_kind: basestring or None
      :param rolling_direction: The sign decides, if to roll backwards or forwards in "time"
      :type rolling_direction: int
      :param max_timeshift: If not None, shift only up to max_timeshift. If None, shift as often as possible.
      :type max_timeshift: int
  
      :return: The rolled data frame or dictionary of data frames
      :rtype: the one from df_or_dict
      """
  
      if rolling_direction == 0:
          raise ValueError("Rolling direction of 0 is not possible")
  
      if isinstance(df_or_dict, dict):
          if column_kind is not None:
              raise ValueError("You passed in a dictionary and gave a column name for the kind. Both are not possible.")
  
          return {key: roll_time_series(df_or_dict=df_or_dict[key],
                                        column_id=column_id,
                                        column_sort=column_sort,
                                        column_kind=column_kind,
                                        rolling_direction=rolling_direction)
                  for key in df_or_dict}
  
      # Now we know that this is a pandas data frame
      df = df_or_dict
  
      if column_id is not None:
          if column_id not in df:
                  raise AttributeError("The given column for the id is not present in the data.")
      else:
          raise ValueError("You have to set the column_id which contains the ids of the different time series")
  
      if column_kind is not None:
          grouper = [column_kind, column_id]
      else:
          grouper = [column_id,]
  
      if column_sort is not None and df[column_sort].dtype != np.object:
  
          # Require no Nans in column
          if df[column_sort].isnull().any():
              raise ValueError("You have NaN values in your sort column.")
  
          df = df.sort_values(column_sort)
  
          # if rolling is enabled, the data should be uniformly sampled in this column
          # Build the differences between consecutive time sort values
  
          differences = df.groupby(grouper)[column_sort].apply(
              lambda x: x.values[:-1] - x.values[1:])
          # Write all of them into one big list
          differences = sum(map(list, differences), [])
          # Test if all differences are the same
          if differences and min(differences) != max(differences):
              warnings.warn("Your time stamps are not uniformly sampled, which makes rolling "
                            "nonsensical in some domains.")
  
      # Roll the data frames if requested
      rolling_direction = np.sign(rolling_direction)
  
      grouped_data = df.groupby(grouper)
      max_timeshift = max_timeshift or grouped_data.count().max().max()
  
      if np.isnan(max_timeshift):
          raise ValueError("Somehow the maximum length of your time series is NaN (Does your time series container have "
                           "only one row?). Can not perform rolling.")
  
      if rolling_direction > 0:
          range_of_shifts = range(max_timeshift, -1, -1)
      else:
          range_of_shifts = range(-max_timeshift, 1)
  
      # Todo: not default for columns_sort to be None
      if column_sort is None:
          column_sort = "sort"
          df[column_sort] = range(df.shape[0])
  
      def roll_out_time_series(time_shift):
          # Shift out only the first "time_shift" rows
          df_temp = grouped_data.shift(time_shift)
          df_temp[column_id] = df[column_sort]
          if column_kind:
              df_temp[column_kind] = df[column_kind]
          return df_temp.dropna()
  
      df_shift = pd.concat([roll_out_time_series(time_shift) for time_shift in range_of_shifts], ignore_index=True)
  
      return df_shift.sort_values(by=[column_id, column_sort])