func_code: def walkback(a, q, i):
      while i > 1 and a[i - 1] == q:
          i -= 1
      return i
  
  
  def bsearch(a, q):
      low = 0
      high = len(a)
      while low < high:
          guess = low + (high - low) // 2
          if a[guess] == q:
              return walkback(a, q, guess)
          elif a[guess] < q:
              low = guess + 1
          else:
              high = guess
      return low