Having this be its own function seems silly; you're not abstracting away anything important, and this line + the docstring are longer than the body of the function. I would just put the loop in-line.