def escape(text, chars=HTML_ESCAPE_CHARS):
    """
    Escape a few XML special chars with XML entities.
    """
    for s, h in chars:
        text = text.replace(s, h)
    return text

    Escape a few XML special chars with XML entities.
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/microdom.py