def _validate_estimator(self):
        """Private function to create the NN estimator"""
        if self.n_neighbors is None:
            estimator = KNeighborsClassifier(n_neighbors=1, n_jobs=self.n_jobs)
        elif isinstance(self.n_neighbors, numbers.Integral):
            estimator = KNeighborsClassifier(
                n_neighbors=self.n_neighbors, n_jobs=self.n_jobs
            )
        elif isinstance(self.n_neighbors, KNeighborsClassifier):
            estimator = clone(self.n_neighbors)

        return estimator
Private function to create the NN estimator
imblearn/under_sampling/_prototype_selection/_condensed_nearest_neighbour.py