def sanitizeHtml(value, base_url=None):
    rjs = '[\\s]*(&#x.{1,7})?'.join(list('javascript:'))
rvb = '[\\s]*(&#x.{1,7})?'.join(list('vbscript:'))
re_scripts = re.compile('(%s)|(%s)' % (rjs, rvb), re.IGNORECASE)
Sanitising user input using Python