code: def brute_force_neighbors(X, Y, k, metric, **kwargs):
      D = DistanceMetric.get_metric(metric, **kwargs).pairwise(Y, X)
      ind = np.argsort(D, axis=1)[:, :k]
      dist = D[np.arange(Y.shape[0])[:, None], ind]
      return dist, ind
  
imports: import itertools
  import pickle
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal
  from sklearn.metrics import DistanceMetric
  from sklearn.neighbors._ball_tree import BallTree, kernel_norm
  from sklearn.neighbors._ball_tree import NeighborsHeap64
  from sklearn.neighbors._ball_tree import nodeheap_sort
  from sklearn.neighbors._ball_tree import simultaneous_sort
  from sklearn.neighbors._kd_tree import KDTree
  from sklearn.neighbors._kd_tree import NeighborsHeap64
  from sklearn.neighbors._kd_tree import nodeheap_sort
  from sklearn.neighbors._kd_tree import simultaneous_sort
  from sklearn.utils import check_random_state
label_desc: Use image node_id 3 for calling a global function with example usage: brute_force_neighbors(X, Y, k, metric) and returns: dist,  ind