code: def partition(l):
      size = len(l)
      # the pivot indfex
      pivot_idx = size // 2
      # the pivot value
      val = l[pivot_idx]
      # the idx of last unsorted elemet
      idx = size - 1
      # move the pivot to the end
      if pivot_idx != idx:
          swap(l, pivot_idx, idx)
  
      # the pivot must stay at the end until the final swap
      idx = idx - 1
      # go through the list of the elements to be sorted
      i = 0
      while i <= idx:
          if l[i] > val:
              while (l[idx] > val) and (idx > i):
                  idx = idx - 1
              if idx != i:
                  swap(l, i, idx)
                  idx = idx - 1
              else:
                  break
          i = i + 1
      # finally bring the pivot at its final place
      assert (idx == i) or (idx + 1 == i)
      swap(l, i, size - 1)
      return i
  
label_desc: Use image node_id 2 for calling a global function with example usage: partition(l) and returns: i