code: def _k_best(tuple_list, k):
      """For a list of tuples [(distance, value), ...] - Get the k-best tuples by
      distance.
      Args:
          tuple_list: List of tuples. (distance, value)
          k: Number of tuples to return.
      """
      tuple_lst = sorted(tuple_list, key=lambda x: x[0], reverse=False)[
          :k
      ]
  
      return tuple_lst
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import collections
  import random
  import numpy
  import pysparnn.matrix_distance
label_desc: Use image node_id 1 for calling a global function with example usage: _k_best(tuple_list, k) and returns: tuple_lst