public String escapeValue(TypeReference typeReference, String valueString) {
        if (valueString == null) {
            return null;
        }
        if (typeReference instanceof SimpleTypeReference) {
            SimpleTypeReference simpleTypeReference = (SimpleTypeReference) typeReference;
            switch (simpleTypeReference.getBaseType()) {
                case UINT:
                case INT:
                    // If it's a one character string and is numeric, output it as char.
                    // This is necessary because in Python strings are Unicode by default
                    // and the "char" type is not a subset of the string type, but rather
                    // a distinct type. If a one character string is written as a string,
                    // it will be encoded as Unicode and not as a single byte.
                    if (!NumberUtils.isParsable(valueString) && (valueString.length() == 1)) {
                        return "'" + valueString + "'";
                    }
                    break;
                case STRING:
                case VSTRING:
                    // The Python string type is Unicode by default, so just add quotes
                    // to the value to make it a string literal.
                    return "\"" + valueString + "\"";
            }
        }
        return valueString;
    }
Escapes a string value according to the type reference given.
<p>
This method is used by the generated Python code to properly handle string values when
writing data to a PLC device.

@param typeReference the type reference of the field the value is being written to.
@param valueString the string value to be escaped.
@return an escaped string value.
code-generation/language-python/src/main/java/org/apache/plc4x/language/python/PythonLanguageTemplateHelper.java