def strip_plaintext_quote(text):
 found_quote = False
 lines = text.strip().splitlines()
 quote_start = None
 for (i, line) in enumerate(lines):
  if line.startswith('>'):
   found_quote = True
   if (quote_start is None):
    quote_start = i
  else:
   found_quote = False
 if found_quote:
  return '\n'.join(lines[:(quote_start - 1)])
 else:
  return text

def strip_plaintext_quote ( text ) : found_quote = False lines = text . strip ( ) . splitlines ( ) quote_start = None for ( i , line ) in enumerate ( lines ) : if line . startswith ( '>' ) : found_quote = True if ( quote_start is None ) : quote_start = i else : found_quote = False if found_quote : return '\n' . join ( lines [ : ( quote_start - 1 ) ] ) else : return text
strip out quoted text with no inline responses .