nodes: 0, module; 1, function_definition; 2, function_name:argsort_k_smallest; 3, parameters; 4, block; 5, identifier:x; 6, identifier:k; 7, expression_statement; 8, if_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, comment:""" Return no more than ``k`` indices of smallest values. """; 14, comparison_operator:k == 0; 15, block; 16, boolean_operator; 17, block; 18, assignment; 19, assignment; 20, subscript; 21, identifier:k; 22, integer:0; 23, return_statement; 24, comparison_operator:k is None; 25, comparison_operator:k >= len(x); 26, return_statement; 27, identifier:indices; 28, subscript; 29, identifier:values; 30, subscript; 31, identifier:indices; 32, call; 33, call; 34, identifier:k; 35, None; 36, identifier:k; 37, call; 38, call; 39, call; 40, slice; 41, identifier:x; 42, identifier:indices; 43, attribute; 44, argument_list; 45, attribute; 46, argument_list; 47, identifier:len; 48, argument_list; 49, attribute; 50, argument_list; 51, attribute; 52, argument_list; 53, identifier:k; 54, identifier:np; 55, identifier:argsort; 56, identifier:values; 57, identifier:np; 58, identifier:array; 59, list; 60, keyword_argument; 61, identifier:x; 62, identifier:np; 63, identifier:argsort; 64, identifier:x; 65, identifier:np; 66, identifier:argpartition; 67, identifier:x; 68, identifier:k; 69, identifier:dtype; 70, attribute; 71, identifier:np; 72, identifier:intp
code: def argsort_k_smallest(x, k):
      """ Return no more than ``k`` indices of smallest values. """
      if k == 0:
          return np.array([], dtype=np.intp)
      if k is None or k >= len(x):
          return np.argsort(x)
      indices = np.argpartition(x, k)[:k]
      values = x[indices]
      return indices[np.argsort(values)]