code: def kvp_minheap_insert(sp, ep, limit, k, v, keys, vals):
      """
      Insert a value (with key) into a heap-organized array subset, only keeping the top values.
  
      Args:
          sp(int): the start of the heap (inclusive)
          ep(int): the current end of the heap (exclusive)
          limit(int): the maximum size of the heap
          k: the key
          v: the value (used for sorting)
          keys: the key array, must be at least sp+limit.
          vals: the value array, same size as keys
  
      Returns:
          int: the new ep
      """
  
      if ep - sp < limit:
          # insert into heap without size problems
          # put on end, then upheap
          keys[ep] = k
          vals[ep] = v
          _pair_upheap(ep - sp, sp, keys, vals)
          return ep + 1
  
      elif v > vals[sp]:
          # heap is full, but new value is larger than old min
          # stick it on the front, and downheap
          keys[sp] = k
          vals[sp] = v
          _pair_downheap(0, sp, limit, keys, vals)
          return ep
  
      else:
          # heap is full and new value doesn't belong
          return ep
  
imports: from numba import njit
  from .array import swap
label_desc: Use image node_id 3 for calling a global function with example usage: kvp_minheap_insert(sp, ep, limit, k, v, keys, vals) and returns: unknown, ep, ep