code: def _partition(array, begin, end):
      x = array[begin]
      i = begin - 1
      j = end + 1
      while True:
          j -= 1
          while array[j] > x:
              j -= 1
          i += 1
          while array[i] < x:
              i += 1
          if i < j:
              array[i], array[j] = array[j], array[i]
          else:
              return j
  
imports: import bisect
  from collections import defaultdict, namedtuple
  from itertools import chain
  import math
  from operator import attrgetter, itemgetter
  import random
  import numpy
label_desc: Use image node_id 24 for calling a global function with example usage: _partition(array, begin, end) and returns: j