input: Write a function to sort a list of tuples by their second elements.
  assert sort_by_second_elem([(1, 3), (2, 1), (4, 2)]) == [(2, 1), (4, 2), (1, 3)]
  assert sort_by_second_elem([(3, 4), (1, 2), (5, 0)]) == [(5, 0), (1, 2), (3, 4)]
  assert sort_by_second_elem([(0, 0), (1, 1), (2, 2)]) == [(0, 0), (1, 1), (2, 2)]
output: def sort_by_second_elem(lst):
      return sorted(lst, key=lambda x: x[1])