input: 
  def insertion_sort(arr):
      """Perform an insertion sort on a given list of integers.
      
      >>> insertion_sort([5, 3, 7, 1, 8])
      [1, 3, 5, 7, 8]
      >>> insertion_sort([9, 7, 5, 3, 1])
      [1, 3, 5, 7, 9]
      """
      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 = j - 1
          arr[j + 1] = key
      return arr
  
output:     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 = j - 1
          arr[j + 1] = key
      return arr