def METHOD_NAME(self, value):
    """Called before adding an item to the selection."""
    if value not in self:
        raise ValueError(
            trans._(
                "Cannot select item that is not in list: {value!r}",
                deferred=True,
                value=value,
            )
        )
    return value