Using python 3.8 I get the following error: AttributeError: module 'cgi' has no attribute 'escape'. Using "html_escape" fixed the issue.