docs: def on_cluster(self, up):
          """Update the cluster views after clustering actions."""
  
          similar = self.similarity_view.selected
  
          # Reinitialize the cluster view if clusters have changed.
          if up.added:
              self._update_cluster_view()
  
          # Select all new clusters in view 1.
          if up.history == 'undo':
              # Select the clusters that were selected before the undone
              # action.
              clusters_0, clusters_1 = up.undo_state[0]['selection']
              # Select rows in the tables.
              self.cluster_view.select(clusters_0, up=up)
              self.similarity_view.select(clusters_1, up=up)
          elif up.added:
              if up.description == 'assign':
                  # NOTE: we change the order such that the last selected
                  # cluster (with a new color) is the split cluster.
                  added = list(up.added[1:]) + [up.added[0]]
              else:
                  added = up.added
              # Select the new clusters in the cluster view.
              self.cluster_view.select(added, up=up)
              if similar:
                  self.similarity_view.next()
          elif up.metadata_changed:
              # Select next in similarity view if all moved are in that view.
              if set(up.metadata_changed) <= set(similar):
                  next_cluster = self.similarity_view.get_next_id()
                  self._update_similarity_view()
                  if next_cluster is not None:
                      # Select the cluster in the similarity view.
                      self.similarity_view.select([next_cluster])
              # Otherwise, select next in cluster view.
              else:
                  self._update_cluster_view()
                  # Determine if there is a next cluster set from a
                  # previous clustering action.
                  cluster = up.metadata_changed[0]
                  next_cluster = self.cluster_meta.get('next_cluster', cluster)
                  logger.debug("Get next_cluster for %d: %s.",
                               cluster, next_cluster)
                  # If there is not, fallback on the next cluster in the list.
                  if next_cluster is None:
                      self.cluster_view.select([cluster], do_emit=False)
                      self.cluster_view.next()
                  else:
                      self.cluster_view.select([next_cluster])