Produce an Internet domain name with the specified number of
        subdomain levels.

        >>> domain_name()
        nichols-phillips.com
        >>> domain_name(2)
        williamson-hopkins.jackson.com
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)
1334961
public GetDomainCacheTTLResponse getDomainCacheTTL(String domain) {
        GetDomainCacheTTLRequest request = new GetDomainCacheTTLRequest().withDomain(domain);
        return getDomainCacheTTL(request);
    }
1351706
public static String domainName() {
        List<String> words = new ArrayList<String>();
        words.add(fixUmlauts(domainWord()));
        words.add(domainSuffix());
        return StringUtils.join(words, ".");

    }
615742
def _domain_variants(domain):
    
    parts = domain.split('.')
    if len(parts) == 1:
        yield parts[0]
    else:
        for i in range(len(parts), 1, -1):
            yield ".".join(parts[-i:])
105176
def get_all_subdomains(self, offset=None, count=None, min_sequence=None, cur=None):
        
        get_cmd = 'SELECT DISTINCT fully_qualified_subdomain FROM {}'.format(self.subdomain_table)
        args = ()

        if min_sequence is not None:
            get_cmd += ' WHERE sequence >= ?'
            args += (min_sequence,)

        if count is not None:
            get_cmd += ' LIMIT ?'
            args += (count,)

        if offset is not None:
            get_cmd += ' OFFSET ?'
            args += (offset,)

        get_cmd += ';'

        cursor = None
        if cur is None:
            cursor = self.conn.cursor()
        else:
            cursor = cur

        rows = db_query_execute(cursor, get_cmd, args)
        subdomains = []
        for row in rows:
            subdomains.append(row['fully_qualified_subdomain'])

        return subdomains
1086020
def DomainFactory(domain_name, cmds):
    """"""
    klass = type(str(domain_name), (BaseDomain,), {})

    for c in cmds:
        command = get_command(domain_name, c['name'])
        setattr(klass, c['name'], classmethod(command))

    return klass
703889
def create_domain(self,
		service_id, 
		version_number, 
		name, 
		comment=None):
		""""""
		body = self._formdata({
			"name": name,
			"comment": comment,

		}, FastlyDomain.FIELDS)
		content = self._fetch("/service/%s/version/%d/domain" % (service_id, version_number), method="POST", body=body)
		return FastlyDomain(self, content)
1070475
public function setSubDomain($level, $subdomain)
  {
    if ($this->isLocked()) {
      return $this->getObj()->setSubDomain($level, $subdomain)->setLocked();
    } else {
      return parent::setSubDomain($level, $subdomain);
    }
  }
743825
def _sub_hostname(self, line):
        '''
        
        '''
        try:
            for od,d in self.dn_db.items():
                #regex = re.compile(r'\w*\.%s' % d)
                regex = re.compile(r'(?![\W\-\:\ \.])[a-zA-Z0-9\-\_\.]*\.%s' % d)
                hostnames = [each for each in regex.findall(line)]
                if len(hostnames) > 0:
                    for hn in hostnames:
                        new_hn = self._hn2db(hn)
                        self.logger.debug("Obfuscating FQDN - %s > %s", hn, new_hn)
                        line = line.replace(hn, new_hn)
            if self.hostname:
                line = line.replace(self.hostname, self._hn2db(self.hostname))  #catch any non-fqdn instances of the system hostname

            return line
        except Exception as e: # pragma: no cover
            self.logger.exception(e)
            raise Exception('SubHostnameError: Unable to Substitute Hostname/Domainname')
619099
def list_subdomains(self, domain, limit=None, offset=None):
        
        # The commented-out uri is the official API, but it is
        # horribly slow.
#        uri = "/domains/%s/subdomains" % utils.get_id(domain)
        uri = "/domains?name=%s" % domain.name
        page_qs = self._get_pagination_qs(limit, offset)
        if page_qs:
            uri = "%s&%s" % (uri, page_qs[1:])
        return self._list_subdomains(uri, domain.id)
483947
public static String domain2ns(String id) {
		int at = id.indexOf('@');
		if (at >= 0) {
			String[] domain = id.substring(at + 1).split("\\.");
			StringBuilder ns = new StringBuilder(id.length());
			boolean first = true;
			for (int i = domain.length - 1; i >= 0; --i) {
				if (first) {
					first = false;
				} else {
					ns.append('.');
				}
				ns.append(domain[i]);
			}
			return ns.toString();
		} else {
			return "";
		}

	}
497141
def _generate_base_lsid(self):
        
        domain = self._generate_domain()
        namespace = self._generate_namespace()

        # Return the base LSID
        return "urn:lsid:" + domain + ":" + namespace
938398
def lookup_domain(domain, nameservers=[], rtype="A",
                  exclude_nameservers=[], timeout=2):
    """"""
    dns_exp = DNSQuery(domains=[domain], nameservers=nameservers, rtype=rtype,
                       exclude_nameservers=exclude_nameservers, timeout=timeout)
    return dns_exp.lookup_domain(domain)
953645
def get_DID_subdomain(did, db_path=None, zonefiles_dir=None, atlasdb_path=None, check_pending=False):
    
    opts = get_blockstack_opts()
    if not is_subdomains_enabled(opts):
        log.warn("Subdomain support is disabled")
        return None

    if db_path is None:
        db_path = opts['subdomaindb_path']

    if zonefiles_dir is None:
        zonefiles_dir = opts['zonefiles']
    
    if atlasdb_path is None:
        atlasdb_path = opts['atlasdb_path']

    db = SubdomainDB(db_path, zonefiles_dir)
    try:
        subrec = db.get_DID_subdomain(did)
    except Exception as e:
        if BLOCKSTACK_DEBUG:
            log.exception(e)

        log.warn("Failed to load subdomain for {}".format(did))
        return None

    if check_pending:
        # make sure that all of the zone files between this subdomain's
        # domain's creation and this subdomain's zone file index are present,
        # minus the ones that are allowed to be missing.
        subrec.pending = db.subdomain_check_pending(subrec, atlasdb_path)

    return subrec
1354504
def domain_add(self, domain, description=DESCRIPTION):
        
        data = {"domain": domain,
                "description": description}
        url = self.build_full_url(self.DOMAINS)
        return self.create_resource(url, data)
1177752
def domain=(d)
      d = d.to_s
      fail ArgumentError unless d.length.between?(1, MAX_VTP_DOMAIN_NAME_SIZE)
      config_set('vtp', 'domain', domain: d)
    end
172677
def get_main_domain(self, website):
        
        subdomains = website['subdomains']
        main_domains = set()
        for sub in subdomains:
            for d in self._domains:
                if sub == d or sub.endswith("." + d):
                    main_domains.add(d)
        if len(main_domains) > 1:
            logger.error(
                "The secure site %s cover multiple domains, it should be splitted" % website['name']
            )
            exit(1)
        elif not main_domains:
            logger.error("We cannot find the main domain for %s" % website['name'])
        return list(main_domains)[0]