class_docstr: Basic implementation of nearest neighbors not relying on scikit-learn.
  
  `kneighbors_graph` is ignored and `metric` does not have any impact.
code: def kneighbors(self, X, n_neighbors=None, return_distance=True):
      n_neighbors = (
          n_neighbors if n_neighbors is not None else self.n_neighbors
      )
      X = X.toarray() if sparse.issparse(X) else X
      distances, indices = self._kd_tree.query(X, k=n_neighbors)
      if return_distance:
          return distances, indices
      return indices
  
imports: import inspect
  import pkgutil
  from importlib import import_module
  from operator import itemgetter
  from pathlib import Path
  import numpy
  from scipy import sparse
  from sklearn.base import BaseEstimator
  from sklearn.neighbors import KDTree
  from sklearn.utils._testing import ignore_warnings
label_desc: Use image node_id 3 for calling the _CustomNearestNeighbors obj's underlying member method code with example usage: obj.kneighbors(X, n_neighbors, return_distance) and returns: indices, distances,  indices