this utility is generic enough to deserve its moving to a module function.
the same thing is used in other places (config/providerconfig), so maybe move it there.