public static String labelToString(String label) {
        if (TensorType.labelMatcher.matches(label)) return label; // no quoting
        if (label.contains("'")) return "\"" + label + "\"";
        return "'" + label + "'";
    }
Returns a label as a string with appropriate quoting/escaping when necessary
vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java