public String getDomainRoot(final String domain, final DomainType expectedType) {
        if (domain == null) {
            return null;
        }
        if (domain.startsWith(".")) {
            return null;
        }
        String normalized = DnsUtils.normalize(domain);
        final boolean punyCoded = normalized.contains("xn-");
        if (punyCoded) {
            normalized = IDN.toUnicode(normalized);
        }
        final DomainRootInfo match = resolveDomainRoot(normalized, expectedType);
        String domainRoot = match != null ? match.root : null;
        if (domainRoot != null && punyCoded) {
            domainRoot = IDN.toASCII(domainRoot);
        }
        return domainRoot;
    }
Returns registrable part of the domain for the given domain name or {@code null}
if given domain represents a public suffix.

@param domain
@param expectedType expected domain type or {@code null} if any.
@return domain root
@since 4.5
httpclient5/src/main/java/org/apache/hc/client5/http/psl/PublicSuffixMatcher.java