Write a Python program to sort a dictionary by its keys.
d = {"name": "John", "age": 24, "class": "Engineering"}
d = {"name": "John", "age": 24, "class": "Engineering"}

sorted_d = sorted(d.items(), key=lambda x: x[0]) 

print(sorted_d)