I am trying to write a try/except block that declares two variables that retrieve their values via `ConfigParser`. The issue I am running into is that it is possible that one or both the values being declared may not be present under a particular section and should be set to `None` in such a case. I am aware that I can simply add the values under to every config file, however, not all of the configs are consistent in section names which turns into a very tedious task. 

Is there a better way to achieve the following try/except block without breaking them up into two separate ones?

```
try:
    ports = getCfgStr(sectName, 'ports')
    terminal = getCfgStr(sectName, 'terminals')
except KeyError:
    # Need to set ports or terminal to None depending on which raised the KeyError

```

My workaround solution:

```
try:
    ports = getCfgStr(sectName, 'ports')
except KeyError:
    ports = None

try:
    terminals = getCfgStr(sectName, 'terminals')
except KeyError:
    terminals = None

```