code: def pairwise_distances_topk(
      X,
      Y=None,
      k=None,
      metric="euclidean",
      return_index=True,
      axis=1,
      working_memory=None,
      **kwds,
  ):
      if k is None:  # pragma: no cover
          raise ValueError("`k` has to be specified")
  
      if Y is None:
          Y = X
      if axis == 0:
          X, Y = Y, X
      if working_memory is None:
          working_memory = options.learn.working_memory
      op = PairwiseDistancesTopk(
          x=X,
          y=Y,
          k=k,
          metric=metric,
          metric_kwargs=kwds,
          return_index=return_index,
          working_memory=working_memory,
      )
      return op(X, Y)
  
imports: from functools import partial
  import numpy
  from ....None import opcodes
  from ....None import options
  from ....core import recursive_tile
  from ....core.operand import OperandStage
  from ....serialization.serializables import KeyField, BoolField, DictField, Int64Field, AnyField
  from ....tensor.core import TensorOrder
  from ....tensor.merge import TensorConcatenate
  from ....tensor.array_utils import as_same_device, device, get_array_module
  from ....utils import has_unknown_shape, ensure_own_data
  from ...utils import gen_batches, get_chunk_n_rows
  from ...utils.validation import _num_samples
  from .core import PairwiseDistances
label_desc: Use image node_id 4 for calling a global function with example usage: pairwise_distances_topk(X, Y, k, metric, return_index, axis, working_memory) and returns: op