Add Python2 and Python3 compatible `string.translate` for hostname customization. Fixes: #54118 (cherry picked from commit 8f89d1d3da)
8f89d1d3da