This is the right idea, but will error if there is no references field. `len(None)` gives a `TypeError`.

`annotation.get('references', [])`

And then you should probably return none, since the moderation target doesn't exist.