def METHOD_NAME(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.
            METHOD_NAME = next(counter)
            self.labels[METHOD_NAME] = trans_labels
            # Cache the result
            _transitions[point] = METHOD_NAME
            return METHOD_NAME