import socket
import ipaddress


def _verify_hostname(host):
    """Verify a hostname is resolvable."""
    try:
        resolved = socket.getaddrinfo(host, None)[0][4][0]
        ip = ipaddress.ip_address(resolved)
        return ip
    except (socket.gaierror, ValueError):
        return False