code: def boundaries_to_intervals(boundaries):
      
  
      if not np.allclose(boundaries, np.unique(boundaries)):
          raise ValueError('Boundary times are not unique or not ascending.')
  
      intervals = np.asarray(list(zip(boundaries[:-1], boundaries[1:])))
  
      return intervals
docs: Convert an array of event times into intervals
  
      Parameters
      ----------
      boundaries : list-like
          List-like of event times.  These are assumed to be unique
          timestamps in ascending order.
  
      Returns
      -------
      intervals : np.ndarray, shape=(n_intervals, 2)
          Start and end time for each interval