def _check_fitted(model):
    """Simple wrapper to check if the KNeighborsClassifier has been fitted."""
    return _sklearn_util.check_fitted(
        model, lambda m: hasattr(m, "_fit_method") or hasattr(m, "_fit_X")
    )
Simple wrapper to check if the KNeighborsClassifier has been fitted.
coremltools/converters/sklearn/_k_neighbors_classifier.py