How would you modify binary search to return the position where a target should be inserted if it is not present in the array?
Implement search_insert(nums, target), returning the first index whose value is greater than or equal to target, while preserving sorted order. nums is a sorted list of integers and may be empty; return an integer in the range 0 through len(nums).
def search_insert(nums, target):