def METHOD_NAME(self, labels, points):
    if not len(points):
        return
    _transitions = {}
    # A counter that skips existing values.
    counter = (c for c in itertools.count() if c not in self.labels)
    # This local function looks up the new id that a point should transition
    # to when `labels` are added to the labels it already has.
    def transition(point):
        nonlocal _transitions
        # Check if we already know the transition of this value.
        if point in _transitions:
            return _transitions[point]
        else:
            # First time making this transition. Join the existing and new labels
            trans_labels = self.labels[point].copy()
            trans_labels.update(labels)
            # Check if this new combination of labels already is assigned an id.
            for k, v in self.labels.items():
                if trans_labels == v:
                    # Transition labels already exist, store and return it
                    _transitions[point] = k
                    return k
            else:
                # Transition labels are a new combination, store them under a new id.
                transition = next(counter)
                self.labels[transition] = trans_labels
                # Cache the result
                _transitions[point] = transition
                return transition
    # Replace the label values with the transition values
    self[points] = np.vectorize(transition)(self[points])