input: Write a function to sort a dictionary by keys and return a list of tuples.
  assert sort_dict_by_key({'c': 10, 'a': 8, 'b': 12, 'e': 3, 'd': 4}) == [('a', 8), ('b', 12), ('c', 10), ('d', 4), ('e', 3)]
  assert sort_dict_by_key({'banana': 2, 'apple': 5, 'pear': 3}) == [('apple', 5), ('banana', 2), ('pear', 3)]
  assert sort_dict_by_key({'x': 1, 'y': 2, 'z': 3}) == [('x', 1), ('y', 2), ('z', 3)]
output: def sort_dict_by_key(d):
      return sorted(d.items())