In general, this utility is long overdue.

In detail, I think error_prefix is odd here -- you're essentially mixing a piece of error formatting (or even logging) with the function.