def bisection_search(arr, x, lo=0, hi=None):
	"""
	Assmues arr is sorted in *ascending* order.
	Returns
		if x in arr, 
			x
		else:
			the index where x should go if we insert by 
			moving everything after idx to the right
	
	This is the same as bisect.bisect_left(arr, x)
	"""
	if not hi:
		hi = len(arr)
	while lo < hi:
		mid = (lo + hi) // 2 #// is integer division
		if x < arr[mid]: hi = mid
		else: lo = mid + 1

	return lo