def plaintext(html, keep=[], replace=blocks, linebreaks=2, indentation=False):
 if isinstance(html, Element):
  html = html.content
 if (not keep.__contains__('script')):
  html = strip_javascript(html)
 if (not keep.__contains__('style')):
  html = strip_inline_css(html)
 if (not keep.__contains__('form')):
  html = strip_forms(html)
 if ((not keep.__contains__('comment')) and (not keep.__contains__('!--'))):
  html = strip_comments(html)
 html = html.replace('\r', '\n')
 html = strip_tags(html, exclude=keep, replace=replace)
 html = decode_entities(html)
 html = collapse_spaces(html, indentation)
 html = collapse_tabs(html, indentation)
 html = collapse_linebreaks(html, linebreaks)
 html = html.strip()
 return html

def plaintext ( html , keep = [ ] , replace = blocks , linebreaks = 2 , indentation = False ) : if isinstance ( html , Element ) : html = html . content if ( not keep . __contains__ ( 'script' ) ) : html = strip_javascript ( html ) if ( not keep . __contains__ ( 'style' ) ) : html = strip_inline_css ( html ) if ( not keep . __contains__ ( 'form' ) ) : html = strip_forms ( html ) if ( ( not keep . __contains__ ( 'comment' ) ) and ( not keep . __contains__ ( '!--' ) ) ) : html = strip_comments ( html ) html = html . replace ( '\r' , '\n' ) html = strip_tags ( html , exclude = keep , replace = replace ) html = decode_entities ( html ) html = collapse_spaces ( html , indentation ) html = collapse_tabs ( html , indentation ) html = collapse_linebreaks ( html , linebreaks ) html = html . strip ( ) return html
returns a string with all html tags removed .