'This simplifies things, and you can use an in-memory StringIO object rather than a file. You can then return this string to flask as a text/html response and avoid Jinja2 entirely.'
I didn't think of this until you mentioned this, so might do that. But I don't get the 'avoid Jinja2 entirely' part. Jinja2 is avoided with the current syntax already (which is definitely changing).
About BeautifulSoup, the autoPrettify() function is actually from bs4, it is a dependency.
Yeah I know, camelCase IS unpythonic
Thanks again