import socket


def _lookup_host(loop, host, family):
    """Look up IPv4 or IPv6 addresses of a host name"""

    try:
        addrinfo = yield from loop.getaddrinfo(host, 0, family=family,
                                               type=socket.SOCK_STREAM)
    except socket.gaierror:
        return []

    return [ai[4][0] for ai in addrinfo]