def escape(data, entities={}):

    # must do ampersand first
    data = data.replace("&", "&amp;")
    data = data.replace(">", "&gt;")
    data = data.replace("<", "&lt;")
    if entities:
        data = __dict_replace(data, entities)
    return data
Escape &, <, and > in a string of data.
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/xml/sax/saxutils.py/escape