You can change these calls to use the dictionary `get()` method default value parameter.

Something like

```python
msg.content_bindings = d.get('content_bindings', [])
kwargs['content_bindings'] = d.get('content_bindings', [])
```
Or a scarier version (Python might do undesirable things internally):

```python
msg.content_bindings = kwargs['content_bindings'] = d.get('content_bindings', [])
```