def is_ip(address):
    for family in (socket.AF_INET, socket.AF_INET6):
        try:
            if type(address) != str:
                address = address.decode('utf8')
            inet_pton(family, address)
            return family
        except (TypeError, __HOLE__, OSError, IOError):
            pass
    return False
dataset/ETHPy150Open ziggear/shadowsocks/shadowsocks/common.py/is_ip