code: def pquery(self, x_list, k=1, eps=0, p=2,
                 distance_upper_bound=np.inf):
          
          x = np.array(x_list)
          nx, mx = x.shape
          shmem_x = mp.Array(ctypes.c_double, nx*mx)
          shmem_d = mp.Array(ctypes.c_double, nx*k)
          shmem_i = mp.Array(ctypes.c_double, nx*k)
  
          _x = shmem_as_nparray(shmem_x).reshape((nx, mx))
          _d = shmem_as_nparray(shmem_d).reshape((nx, k))
  
          _i = shmem_as_nparray(shmem_i)
          if k != 1:
              _i = _i.reshape((nx, k))
  
          _x[:, :] = x
  
          nprocs = num_cpus()
          scheduler = Scheduler(nx, nprocs)
  
          ierr = mp.Value(ctypes.c_int, 0)
  
          query_args = (scheduler,
                        self.shmem_data, self.n, self.m, self.leafsize,
                        shmem_x, nx, shmem_d, shmem_i,
                        k, eps, p, distance_upper_bound,
                        ierr)
          pool = [mp.Process(target=_pquery, args=query_args) for _ in range(nprocs)]
          for p in pool: p.start()
          for p in pool: p.join()
          if ierr.value != 0:
              raise RuntimeError('%d errors in worker processes' % (ierr.value))
  
          return _d.copy(), _i.astype(int).copy()
docs: Function to parallelly query the K-D Tree