public static String jmxSanitize(String name) {
        return MBEAN_PATTERN.matcher(name).matches() ? name : ObjectName.quote(name);
    }
Quote `name` using {@link ObjectName#quote(String)} if `name` contains
characters that are not safe for use in JMX. User principals that are
already sanitized using {@link #sanitize(String)} will not be quoted
since they are safe for JMX.
clients/src/main/java/org/apache/kafka/common/utils/Sanitizer.java