code: def brute_force_distances(metric, items, query_items, k):
      dists = np.zeros((query_items.shape[0], items.shape[0]))
      for ii in range(items.shape[0]):
          for jj in range(query_items.shape[0]):
              dists[jj, ii] = get_dist(
                  metric, items[ii, :], query_items[jj, :]
              )
  
      labels = np.argsort(
          dists, axis=1
      )  # equivalent, but faster: np.argpartition(dists, range(k), axis=1)
      dists = np.sort(
          dists, axis=1
      )  # equivalent, but faster: np.partition(dists, range(k), axis=1)
  
      return labels[:, :k], dists[:, :k]
  
file_path: hnswlib/tests/python/bindings_test_pickle.py
imports: import pickle
  import unittest
  import numpy
  import hnswlib
label_desc: Use image node_id 2 for calling a global function with example usage: brute_force_distances(metric, items, query_items, k) and returns: labels,  dists