def METHOD_NAME(self, _property: SparseLabelOpsFactory | None, _type: type) -> None:
    """An internal utility method to handle the attribute setter implementation.
    Args:
        _property: the SparseLabelOpsFactory to set. If `None`, the internally stored property of the
            indicated type (see next argument) will be discarded instead of set.
        _type: the target SparseLabelOpsFactory type of this setter.
    Raises:
        TypeError: if the provided SparseLabelOpsFactory does not match the indicate type.
    """
    if _property is None:
        self.discard(_type)
        return
    if not isinstance(_property, _type):
        raise TypeError(
            f"Only objects of type '{_type.__name__}' are supported, not {type(_property)}."
        )
    self.add(_property)