code: def undo(self):
          
          _, _, undo_state = self._undo_stack.back()
  
          # Retrieve the initial spike_cluster structure.
          spike_clusters_new = self._spike_clusters_base.copy()
  
          # Loop over the history (except the last item because we undo).
          for spike_ids, cluster_ids, _ in self._undo_stack:
              # We update the spike clusters accordingly.
              if spike_ids is not None:
                  spike_clusters_new[spike_ids] = cluster_ids
  
          # What are the spikes affected by the last changes?
          changed = np.nonzero(self._spike_clusters !=
                               spike_clusters_new)[0]
          clusters_changed = spike_clusters_new[changed]
  
          up = self._do_assign(changed, clusters_changed)
          up.history = 'undo'
          # Add the undo_state object from the undone object.
          up.undo_state = undo_state
  
          self.emit('cluster', up)
          return up
docs: Undo the last cluster assignment operation.
  
          Returns
          -------
  
          up : UpdateInfo instance of the changes done by this operation.