You can combine the validation and fetching into a single statement.

```
directory = instance.get('directory', None)
queue = instance.get('queue', None)
if not queue or not directory:
    raise Exception("expected configuration .... ")
```