Figures out the full host name for the given domain part.  The
        domain part is a subdomain in case host matching is disabled or
        a full host name.
177988
def get_host(self, domain_part):
        
        if self.map.host_matching:
            if domain_part is None:
                return self.server_name
            return to_unicode(domain_part, "ascii")
        subdomain = domain_part
        if subdomain is None:
            subdomain = self.subdomain
        else:
            subdomain = to_unicode(subdomain, "ascii")
        return (subdomain + u"." if subdomain else u"") + self.server_name
7177
def domain_name(self, levels=1):
        
        if levels < 1:
            raise ValueError("levels must be greater than or equal to 1")
        if levels == 1:
            return self.domain_word() + '.' + self.tld()
        else:
            return self.domain_word() + '.' + self.domain_name(levels - 1)
958363
def subdomain?(*jids)
      !jids.flatten.index do |jid|
        !component?(jid) && !pubsub?(jid)
      end
    end
244981
public boolean contains(final InternetDomainName domain) {
        ImmutableList<String> otherDomainParts = domain.parts();

        if (parts.size() > otherDomainParts.size()) {
            return false;
        }

        otherDomainParts = otherDomainParts.reverse()
                .subList(0, parts.size());

        return parts.reverse()
                .equals(otherDomainParts);
    }
1045807
def hostname(self, levels=1):
        
        if levels < 1:
            return self.random_element(self.hostname_prefixes) + '-' + self.numerify('##')
        return self.random_element(self.hostname_prefixes) + '-' + self.numerify('##') + '.' + self.domain_name(levels)
49582
def privateparts(self, domain):
        
        s = self.privatesuffix(domain)
        if s is None:
            return None
        else:
            # I know the domain is valid and ends with private suffix
            pre = domain[0:-(len(s)+1)]
            if pre == "":
                return (s,)
            else:
                return tuple(pre.split(".") + [s])
400463
function getDomain(url) {
	var domain = _.isObject(url) ? url.host : urlib.parse(url).host;
	return domain || url;
}
666280
def extract_domain(host):
    
    host = re.sub('https?://', '', host)
    host = re.match('([^/]+)', host).groups()[0]
    domain = '.'.join(host.split('.')[-2:])
    if domain in _domains:
        domain = '.'.join(host.split('.')[-3:])
    return domain
1155908
def get_ip_address(domain):
    
    if "://" not in domain:
        domain = "http://" + domain

    hostname = urlparse(domain).netloc

    if not hostname:
        raise ValueError("Can't parse hostname!")

    return socket.gethostbyname(hostname)
701897
function GetSubdomain()
    {
        $host = $this->host;
        $sub = substr($host, 0, strlen($host) - strlen($this->GetDomain()));
        return rtrim($sub, '.');
    }
1195300
public function getFullHost()
    {
        // Case 1: Host hasn't suffix, possibly IP.

        if (null === $this->suffix) {
            return $this->hostname;
        }

        // Case 2: Domain with suffix, but without subdomain.

        if (null === $this->subdomain) {
            return $this->hostname . '.' . $this->suffix;
        }

        // Case 3: Domain with suffix & subdomain.

        return implode('.', [$this->subdomain, $this->hostname, $this->suffix]);
    }
1200319
public function getSubdomain($host)
    {
        $host = strtolower($host);
        $registerableDomain = $this->getRegisterableDomain($host);

        if ($registerableDomain === null || $host == $registerableDomain) {
            return null;
        }

        $registerableDomainParts = array_reverse(explode('.', $registerableDomain));
        $hostParts = array_reverse(explode('.', $host));
        $subdomainParts = array_slice($hostParts, count($registerableDomainParts));

        return implode('.', array_reverse($subdomainParts));
    }
381683
def host_names(urls):
    '''
    
    '''
    host_names = StringCounter()
    for url in urls:
        host_names[urlparse(url).netloc] += urls[url]
    return host_names
1004499
public function matchDomain($domain)
    {
        $host = $this->host;
        if (is_null($host)) {
            return false;
        }

        $match_domain = explode('.', $domain);
        $match_host = array_slice(explode('.', $host), count($match_domain) * -1);

        return (strcasecmp($domain, implode('.', $match_host)) === 0);
    }
1292778
def _dnsname_match(dn, hostname, max_wildcards=1):
    
    pats = []
    if not dn:
        return False

    split_dn = dn.split(r'.')
    leftmost, remainder = split_dn[0], split_dn[1:]

    wildcards = leftmost.count('*')
    if wildcards > max_wildcards:
        # Issue #17980: avoid denials of service by refusing more
        # than one wildcard per fragment.  A survey of established
        # policy among SSL implementations showed it to be a
        # reasonable choice.
        raise CertificateError(
            "too many wildcards in certificate DNS name: " + repr(dn))

    # speed up common case w/o wildcards
    if not wildcards:
        return dn.lower() == hostname.lower()

    # RFC 6125, section 6.4.3, subitem 1.
    # The client SHOULD NOT attempt to match a presented identifier in which
    # the wildcard character comprises a label other than the left-most label.
    if leftmost == '*':
        # When '*' is a fragment by itself, it matches a non-empty dotless
        # fragment.
        pats.append('[^.]+')
    elif leftmost.startswith('xn--') or hostname.startswith('xn--'):
        # RFC 6125, section 6.4.3, subitem 3.
        # The client SHOULD NOT attempt to match a presented identifier
        # where the wildcard character is embedded within an A-label or
        # U-label of an internationalized domain name.
        pats.append(re.escape(leftmost))
    else:
        # Otherwise, '*' matches any dotless string, e.g. www*
        pats.append(re.escape(leftmost).replace(r'\*', '[^.]*'))

    # add the remaining fragments, ignore any wildcards
    for frag in remainder:
        pats.append(re.escape(frag))

    pat = re.compile(r'\A' + r'\.'.join(pats) + r'\Z', re.IGNORECASE)
    return pat.match(hostname)
470052
function isExactDomainMatch(part: string, debuggeeHost: string): boolean {
  return part.startsWith("www.")
    ? part.substr("www.".length) === debuggeeHost
    : part === debuggeeHost;
}
932547
def is_subdomain(domain, reference):
    
    index_of_reference = domain.find(reference)
    if index_of_reference > 0 and domain[index_of_reference:] == reference:
        return True
    return False