import socket


def is_ip(addr):
    """
    Determine if an address looks like IPv4 or IPv6
    """
    for family in [socket.AF_INET, socket.AF_INET6]:
        try:
            socket.inet_pton(family, addr)
            return True
        except socket.error:
            pass

    return False