I think that this function needs a docstring, even if is a very short one.

Also, I believe that it should be moved to utils, as it can be of general interest and will not be found where it currently is.