For a block like this, consider the use of a list comprension:

```
object_ids = [item['_id'] for item in ret_vals if item['_type'] == "NotificationRequest"]
```

Obviously they are not a panacea, they can get difficult to read with any more complexity, but for a case like this, it can actually improve readability.  Don't bother updating this one but just a note for the future.