input: Write a python function to perform a binary search on a sorted list.
  assert binary_search([1, 2, 3, 4, 5, 6, 7, 8, 9], 6) == 5
  assert binary_search([1, 2, 3, 4, 5, 6, 7, 8, 9], 1) == 0
  assert binary_search([1, 2, 3, 4, 5, 6, 7, 8, 9], 9) == 8
  assert binary_search([1, 2, 3, 4, 5, 6, 7, 8, 9], 10) == None
output: def binary_search(arr, target):
      left, right = 0, len(arr) - 1
      while left <= right:
          mid = (left + right) // 2
          if arr[mid] == target:
              return mid
          elif arr[mid] < target:
              left = mid + 1
          else:
              right = mid - 1
      return None