Use pytidylib to clean up HTML (if it's installed)

Fall back to previous behavior if tidylib is unavailable.