def in_iplist(ip, l):
    # no input validations here as it should be fast
    for item in l:
        if '/' in item:
            a, mask = item.split('/')
            m = mask2long(int(mask))
            # IP range contains IP address only if the masked range equals the masked address
            if (ip2long(a) & m) == (ip2long(ip) & m):
                return True
        else:
            if item == ip:
                return True
    return False
Check if IP address is in the list.
dataset/ETHPy150Open securitykiss-com/rfw/rfw/iputil.py/in_iplist