Format a value for display as an XML text node.

    Returns:
        Unicode string (str on Python 3, unicode on Python 2)

def quote_xml(text):
    """Format a value for display as an XML text node.

    Returns:
        Unicode string (str on Python 3, unicode on Python 2)
    """
    text = _coerce_unicode(text)

    # If it's a CDATA block, return the text as is.
    if text.startswith(CDATA_START):
        return text

    # If it's not a CDATA block, escape the XML and return the character
    # encoded string.
    return saxutils.escape(text)