The new library function will be reused by subsequent commits. (cherry picked from commit 151cc2fff9)
151cc2fff9