def number_of_neighbors_allowed_range(self):
        """
        Get the range of allowed values for the numberOfNeighbors parameter.

        Returns
        -------
        Tuple of (``min_value``, ``max_value``) or ``None`` if the range hasn't been set.
        """
        if self.spec.kNearestNeighborsClassifier.numberOfNeighbors.HasField("range"):
            return (
                self.spec.kNearestNeighborsClassifier.numberOfNeighbors.range.minValue,
                self.spec.kNearestNeighborsClassifier.numberOfNeighbors.range.maxValue,
            )
        return None

        Get the range of allowed values for the numberOfNeighbors parameter.

        Returns
        -------
        Tuple of (``min_value``, ``max_value``) or ``None`` if the range hasn't been set.
        
coremltools/models/nearest_neighbors/builder.py