Returns True when 'addr' belongs to prefix/plen. False otherwise.
436241
def in6_isincluded(addr, prefix, plen):
    
    temp = inet_pton(socket.AF_INET6, addr)
    pref = in6_cidr2mask(plen)
    zero = inet_pton(socket.AF_INET6, prefix)
    return zero == in6_and(temp, pref)
931319
private boolean hasStage (InputProcessor processor) {
		if (!(processor instanceof InputMultiplexer)) {
			return processor == stage;
		}
		InputMultiplexer im = (InputMultiplexer)processor;
		SnapshotArray<InputProcessor> ips = im.getProcessors();
		for (InputProcessor ip : ips) {
			if (hasStage(ip)) {
				return true;
			}
		}
		return false;
	}
99576
def has_api_scope_with_prefix(self, prefix):
        
        if self._authorized_api_scopes is None:
            return None
        return any(
            x == prefix or x.startswith(prefix + '.')
            for x in self._authorized_api_scopes)
38823
def next_addr(addr, i):
    """"""
    str_addr = pad_zeroes(str(int_addr(addr) + i), len(addr[1:]))
    return addr[0] + str_addr
108754
def is_subnet_present(self, subnet_addr):
        
        try:
            subnet_list = self.neutronclient.list_subnets(body={})
            subnet_dat = subnet_list.get('subnets')
            for sub in subnet_dat:
                if sub.get('cidr') == subnet_addr:
                    return True
            return False
        except Exception as exc:
            LOG.error("Failed to list subnet %(sub)s, Exc %(exc)s",
                      {'sub': subnet_addr, 'exc': str(exc)})
            return False
1298041
def addr=(addr)
      @addr = addr
      @me = Node.new @id, @addr, true
      Directory[@id].address = addr
      ObjectSpace.define_finalizer(me, proc { Directory.remove @id })
    end
1012299
def is_prefix(cls, result):
        
        from boto.s3.prefix import Prefix

        return isinstance(result, Prefix) or cls._is_gs_folder(result)
1147593
private static boolean isIPv6Addr(String host) {
        if (host != null) {
            if (host.contains("[") && host.contains("]"))
                host = host.substring(host.indexOf("[") + 1, host.indexOf("]"));
            host = host.toLowerCase();
            Pattern p1 = Pattern.compile("^(?:(?:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9](?::|$)){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))$");
            Pattern p2 = Pattern.compile("^(\\d{1,3}\\.){3}\\d{1,3}$");
            Matcher m1 = p1.matcher(host);
            boolean b1 = m1.matches();
            Matcher m2 = p2.matcher(host);
            boolean b2 = !m2.matches();
            return b1 && b2;
        } else {
            return false;
        }
    }
643542
public IPRangeNode findAddr(InetAddress addr) {

	for (IPRangeNode c: this.list) {

	    IPRangeNode result = c.findAddr(addr);

	    if (result != null) return result;
	}

	return null;
    }
403088
def ip_bracket(addr):
    '''
    
    '''
    addr = ipaddress.ip_address(addr)
    return ('[{}]' if addr.version == 6 else '{}').format(addr)
972941
private static boolean addressIsWithin(Location location, long address) {
        long endpoint = location.from() + location.size();
        return address >= location.from() && address < endpoint;
    }
1174821
def get_if_raw_addr6(iff):
    
    ip6 = get_if_addr6(iff)
    if ip6 is not None:
        return inet_pton(socket.AF_INET6, ip6)

    return None
121003
def is_valid_vpnv4_prefix(prefix):
    
    if not isinstance(prefix, str):
        return False

    # Split the prefix into route distinguisher and IP
    tokens = prefix.split(':', 2)
    if len(tokens) != 3:
        return False

    # Validate route distinguisher
    if not is_valid_route_dist(':'.join([tokens[0], tokens[1]])):
        return False

    # Validate IPv4 prefix and return
    return is_valid_ipv4_prefix(tokens[2])
1153478
def is_public(addr):
    # type: (Union[str, unicode]) -> bool
    
    addr_domain = domain(addr)
    if not addr_domain:
        # anybody can use invalid email
        return True
    chunks = addr_domain.rsplit(".", 1)

    return len(chunks) < 2 \
        or addr_domain.endswith("local") \
        or addr_domain in public_domains()
1334508
private boolean isIPV4address(String address) {
        StringTokenizer st = new StringTokenizer(address, ".");
        List<String> nodes = new ArrayList<String>();
        while (st.hasMoreTokens())
            nodes.add(st.nextToken());
        return (nodes.size() == 4);
    }
855982
function hasPrefix(property, prefix) {
		var info = vendorPrefixes[prefix];
		
		if (!info)
			info = utils.find(vendorPrefixes, function(data) {
				return data.prefix == prefix;
			});
		
		return info && info.supports(property);
	}
1216248
def in6_get6to4Prefix(addr):
    
    try:
        addr = inet_pton(socket.AF_INET, addr)
        addr = inet_ntop(socket.AF_INET6, b'\x20\x02'+addr+b'\x00'*10)
    except:
        return None
    return addr