code: def util_pattern_space(time_series, lag, dim):
      
      n = len(time_series)
  
      if lag * dim > n:
          raise Exception('Result matrix exceeded size limit, try to change lag or dim.')
      elif lag < 1:
          raise Exception('Lag should be greater or equal to 1.')
  
      pattern_space = np.empty((n - lag * (dim - 1), dim))
      for i in range(n - lag * (dim - 1)):
          for j in range(dim):
              pattern_space[i][j] = time_series[i + j * lag]
  
      return pattern_space
docs: Create a set of sequences with given lag and dimension
  
      Args:
         time_series: Vector or string of the sample data
         lag: Lag between beginning of sequences
         dim: Dimension (number of patterns)
  
      Returns:
          2D array of vectors