You should default it to None, otherwise it'll fail if there is no location:
```python
gateway_location = gateway.get("location", None)
```