All of these are rather ugly - can't we use the `.get(key)` API and catch `NoKeyError` (and `NoGroupError` if necessary).