code: def regular_subset(spikes, n_spikes_max=None, offset=0):
      
      assert spikes is not None
      # Nothing to do if the selection already satisfies n_spikes_max.
      if n_spikes_max is None or len(spikes) <= n_spikes_max:  # pragma: no cover
          return spikes
      step = math.ceil(np.clip(1. / n_spikes_max * len(spikes),
                               1, len(spikes)))
      step = int(step)
      # Note: randomly-changing selections are confusing...
      my_spikes = spikes[offset::step][:n_spikes_max]
      assert len(my_spikes) <= len(spikes)
      assert len(my_spikes) <= n_spikes_max
      return my_spikes
docs: Prune the current selection to get at most n_spikes_max spikes.