You could simply write:

```python
storage_totals = data['stats']['storageTotals']
```
as if stats is empty it will fail anyway