Gets the rdns String name
    :param rdns: RDNS object
    :type rdns: cryptography.x509.RelativeDistinguishedName
    :return: RDNS name
101
def get_rdns_name(rdns):
    
    name = ''
    for rdn in rdns:
        for attr in rdn._attributes:
            if len(name) > 0:
                name = name + ','
            if attr.oid in OID_NAMES:
                name = name + OID_NAMES[attr.oid]
            else:
                name = name + attr.oid._name
            name = name + '=' + attr.value
    return name
492006
def get_name(path_name, *, ext=True, override=None, identity=None):
    
    if identity is None:
        identity = identify(path_name, override=override)

    if identity == ISFILE:
        if ext:
            r = os.path.basename(path_name)
        else:
            r = os.path.splitext(os.path.basename(path_name))[NAME]
    else:
        r = ''
    return r
12721
def qname(self, uri, generate=False):
        
        try:
            prefix, namespace, name = self.g.namespace_manager.compute_qname(uri, generate=generate)
            qname = ':'.join((prefix, name))
            return qname
        except (KeyError, ValueError) as e:
            return uri.toPython() if isinstance(uri, rdflib.URIRef) else uri
90419
def findInRemotesByName(self, name: str):
        
        remotes = [r for r in self.remotes.values()
                   if r.name == name]
        if len(remotes) > 1:
            raise DuplicateRemotes(remotes)
        if not remotes:
            raise RemoteNotFound(name)
        return remotes[0]
105968
def determine_orig_wcsname(header, wnames, wkeys):
    
    orig_wcsname = None
    orig_key = None
    if orig_wcsname is None:
        for k,w in wnames.items():
            if w[:4] == 'IDC_':
                orig_wcsname = w
                orig_key = k
                break
    if orig_wcsname is None:
        # No IDC_ wcsname found... revert to second to last if available
        if len(wnames) > 1:
            orig_key = wkeys[-2]
            orig_wcsname = wnames[orig_key]
    return orig_wcsname,orig_key
826465
def _ReverseHostname(self, hostname):
    
    if not hostname:
      return ''

    if len(hostname) <= 1:
      return hostname

    if hostname[-1] == '.':
      return hostname[::-1][1:]

    return hostname[::-1][0:]
934883
def master_primary_name(self) -> Optional[str]:
        

        master_primary_name = self.master_replica.primaryName
        if master_primary_name:
            return self.master_replica.getNodeName(master_primary_name)
        return None
591035
def rpc_get_name_DID(self, name, **con_info):
        
        did_info = None
        if check_name(name):
            did_info = self.get_name_DID_info(name)
        elif check_subdomain(name):
            did_info = self.get_subdomain_DID_info(name)
        else:
            return {'error': 'Invalid name or subdomain', 'http_status': 400}

        if did_info is None:
            return {'error': 'No DID for this name', 'http_status': 404}

        did = make_DID(did_info['name_type'], did_info['address'], did_info['index'])
        return self.success_response({'did': did})
154364
public static ASN1Set getLastNameEntry(X500Name name) {
        RDN[] rdns = name.getRDNs();
        int size = rdns.length;
        return (size > 0) ? (ASN1Set) rdns[size - 1].toASN1Primitive() : null;
    }
1111092
private List<String> rdName()
	{
		List<String> names = new Vector<String>();
		names.add(rdIdentifier());

		if (ch == '`')
		{
			if (startOfName(rdCh()))
			{
				names.add(rdIdentifier());
			}
		}

		if (names.size() == 2)
		{
			// We have the strange mk_Mod`name case...

			String first = names.get(0);

			if (first.startsWith("mk_") || first.startsWith("is_"))
			{
				List<String> one = new Vector<String>();
				one.add(first + "`" + names.get(1));
				names = one;
			}
		}

		return names;
	}
1322829
def _lookup_dnspython(name, rdtype, timeout=None, servers=None, secure=None):
    '''
    
    '''
    resolver = dns.resolver.Resolver()

    if timeout is not None:
        resolver.lifetime = float(timeout)
    if servers:
        resolver.nameservers = servers
    if secure:
        resolver.ednsflags += dns.flags.DO

    try:
        res = [_data_clean(rr.to_text())
               for rr in resolver.query(name, rdtype, raise_on_no_answer=False)]
        return res
    except dns.rdatatype.UnknownRdatatype:
        raise ValueError('Invalid DNS type {}'.format(rdtype))
    except (dns.resolver.NXDOMAIN,
            dns.resolver.YXDOMAIN,
            dns.resolver.NoNameservers,
            dns.exception.Timeout):
        return False
251458
public List<RDN> rdns() {
        List<RDN> list = rdnList;
        if (list == null) {
            list = Collections.unmodifiableList(Arrays.asList(names));
            rdnList = list;
        }
        return list;
    }
1112852
def find_rtr_namespace(self, rout_id):
        
        if rout_id is None:
            return None
        args = ['ip', 'netns', 'list']
        try:
            ns_list = utils.execute(args, root_helper=self.root_helper)
        except Exception as exc:
            LOG.error("Unable to find the namespace list Exception %s",
                      exc)
            return None
        for ns in ns_list.split():
            if 'router' in ns and rout_id in ns:
                return ns
1001793
def read_name(self):
        """"""
        result = ''
        off = self.offset
        next = -1
        first = off

        while 1:
            len = ord(self.data[off])
            off += 1
            if len == 0:
                break
            t = len & 0xC0
            if t == 0x00:
                result = ''.join((result, self.read_utf(off, len) + '.'))
                off += len
            elif t == 0xC0:
                if next < 0:
                    next = off + 1
                off = ((len & 0x3F) << 8) | ord(self.data[off])
                if off >= first:
                    raise Exception(
                            "Bad domain name (circular) at " + str(off))
                first = off
            else:
                raise Exception("Bad domain name at " + str(off))

        if next >= 0:
            self.offset = next
        else:
            self.offset = off

        return result
690470
def get_name(self):
        
        self.name = self.name or graceful_get(self.inspect(refresh=False), "Name")
        return self.name
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)
306735
def get_full_name(self):
        
        if self.is_tpl():
            return "tpl-%s/%s" % (getattr(self, 'host_name', 'XxX'), self.name)
        if hasattr(self, 'host_name') and hasattr(self, 'service_description'):
            return "%s/%s" % (self.host_name, self.service_description)
        return 'UNKNOWN-SERVICE'