#NEWLINE# def clean( text , tags = ALLOWED_TAGS , attributes = ALLOWED_ATTRIBUTES , styles = ALLOWED_STYLES , protocols = ALLOWED_PROTOCOLS , strip = False , strip_comments = True ) : #NEWLINE# #INDENT# 'Clean an HTML fragment and return it\n\n    :arg text: the text to clean\n    :arg tags: whitelist of allowed tags; defaults to\n        ``bleach.ALLOWED_TAGS``\n    :arg attributes: whitelist of allowed attributes; defaults to\n        ``bleach.ALLOWED_ATTRIBUTES``\n    :arg styles: whitelist of allowed css; defaults to\n        ``bleach.ALLOWED_STYLES``\n    :arg protocols: whitelist of allowed protocols for links; defaults\n        to ``bleach.ALLOWED_PROTOCOLS``\n    :arg strip: whether or not to strip disallowed elements\n    :arg strip_comments: whether or not to strip HTML comments\n\n    ' #NEWLINE# if ( not text ) : #NEWLINE# #INDENT# return '' #NEWLINE# #UNINDENT# text = force_unicode ( text ) #NEWLINE# class s ( BleachSanitizer ) : #NEWLINE# #INDENT# allowed_elements = tags #NEWLINE# allowed_attributes = attributes #NEWLINE# allowed_css_properties = styles #NEWLINE# allowed_protocols = protocols #NEWLINE# strip_disallowed_elements = strip #NEWLINE# strip_html_comments = strip_comments #NEWLINE# #UNINDENT# parser = html5lib . HTMLParser ( tokenizer = s ) #NEWLINE# return _render ( parser . parseFragment ( text ) )