input: Write a python function to sort a list of tuples based on a specified key in ascending or descending order.
  assert sort_list_of_tuples([(1, 11, 4), (2, 3, 5), (3, 2, 1), (4, 15, 9)], 2, reverse=False) == [(3, 2, 1), (1, 11, 4), (2, 3, 5), (4, 15, 9)]
  assert sort_list_of_tuples([(1, 11, 4), (2, 3, 5), (3, 2, 1), (4, 15, 9)], 2, reverse=True) == [(4, 15, 9), (2, 3, 5), (1, 11, 4), (3, 2, 1)]
  assert sort_list_of_tuples([(1, 5), (3, 1), (2, 7)], 1, reverse=False) == [(3, 1), (1, 5), (2, 7)]
  assert sort_list_of_tuples([(1, 5), (3, 1), (2, 7)], 1, reverse=True) == [(2, 7), (1, 5), (3, 1)]
output: def sort_list_of_tuples(lst, key_index, reverse=False):
      return sorted(lst, key=lambda x: x[key_index], reverse=reverse)