he escape() function is used to convert the <, &, and > characters to the corresponding entity references: code example
Example: he escape() function is used to convert the <, &, and > characters to the corresponding entity references:
1 >>> from xml.sax.saxutils import escape
2 >>>
3 >>> escape("< & >")
4 '< & >'