Nothing wrong with this, but looks like it's repeated 3-4 times in this diff (at least).
Candidate for a helper function. :shrug: