def cleanup_subject(subject_str):
 if (subject_str is None):
  return ''
 cleanup_regexp = '(?i)^((re|fw|fwd|aw|wg|undeliverable|undelivered):\\s*)+'
 return re.sub(cleanup_regexp, '', subject_str)

def cleanup_subject ( subject_str ) : if ( subject_str is None ) : return '' cleanup_regexp = '(?i)^((re|fw|fwd|aw|wg|undeliverable|undelivered):\\s*)+' return re . sub ( cleanup_regexp , '' , subject_str )
clean-up a message subject-line .