How to handle KeyError using get().