input: Write a function to perform an insertion sort on a given list of integers. The function should return the sorted list. If the input list is empty, the function should return the empty list.
  assert insertion_sort([4, 2, 3, 1]) == [1, 2, 3, 4]
  assert insertion_sort([5, 3, 6, 2, 10]) == [2, 3, 5, 6, 10]
  assert insertion_sort([]) == []
  assert insertion_sort([1, 2, 3, 4]) == [1, 2, 3, 4]
  assert insertion_sort([7, 4, 8, 2, 9]) == [2, 4, 7, 8, 9]
output: def insertion_sort(arr):
      for i in range(1, len(arr)):
          key = arr[i]
          j = i - 1
          while j >= 0 and key < arr[j]:
              arr[j + 1] = arr[j]
              j -= 1
          arr[j + 1] = key
      return arr