bringing sanity to world of messed-up data
sanitize
is a Python module for making sure various things (e.g. HTML) are safe to use. It was originally written by Mark Pilgrim (@diveintomark) and is distributed under the BSD license.
Usage:
>>> import sanitize
>>> sanitize.HTML('safe<meta http-equiv="Refresh" content="0; URL=/">')
'safe'
To install:
$ pip install sanitize