input: Write a function to sort a list of tuples based on the second element of each tuple.
  assert sort_by_second([(1, 2), (3, 1), (2, 3)]) == [(3, 1), (1, 2), (2, 3)]
  assert sort_by_second([(5, 10), (3, 5), (7, 2)]) == [(7, 2), (3, 5), (5, 10)]
  assert sort_by_second([(1, 3), (3, 2), (2, 1)]) == [(2, 1), (3, 2), (1, 3)]
output: def sort_by_second(lst):
      return sorted(lst, key=lambda x: x[1])