Could also just have this as `_get_ref_block(blocks, name)` so you don't create it each time, although that's a micro-optimization. I guess it just looks a little out of place stylistically to me, but I'm not sure about it.

Also, obligatory one-liner :P

```python
get_ref_block = lambda name: next((b for i, b in enumerate(blocks) if b['name'] == name), None)
```