Construct a program in Python to sort all the elements in an array using the insertion sort algorithm.
[2, 11, 9, 5, 8]
def insertion_sort(arr):
    # Traverse through 1 to len(arr) 
    for i in range(1, len(arr)): 
  
        key = arr[i] 
  
        # Move elements of arr[0..i-1], that are 
        # greater than key, to one position ahead 
        # of their current position 
        j = i-1
        while j >=0 and key < arr[j] : 
                arr[j+1] = arr[j] 
                j -= 1
        arr[j+1] = key    
  
# Driver code to test above 
arr = [2, 11, 9, 5, 8] 
insertion_sort(arr) 

print ("Sorted array is:") 
for i in range(len(arr)): 
    print ("%d" %arr[i])