def escape(string, quote=False):
    if string is None:
        return ''
    elif hasattr(string, '__html__'):
        return unicode(string)
    string = string.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
    if quote:
        string = string.replace('"', "&quot;")
    return string
Standard HTML text escaping, but protecting against the agressive
dataset/ETHPy150Open quokkaproject/flask-htmlbuilder/flaskext/htmlbuilder.py/escape