Move to top of file, also would it make sense to split this out as a ``def _sanatize_hostname(hostname): ...`` just inside this file?