import socket


def nslookup_all(ip, family=None):
    """ returns a list of IPv4/IPv6 addresses related to an IP/HOST

    """
    family = socket.AF_INET if family == 'ipv4' else socket.AF_INET6 if family == 'ipv6' else 0
    output = socket.getaddrinfo(ip, 0, family=family)
    ret = []
    try:
        for o in output:
            ret.append(o[4][0])
    except socket.gaierror:
        pass
    return ret