def _safe_gethostbyname(host): try: return socket.gethostbyname(host) except socket.gaierror: return None