def DocToHelp(doc):
 doc = doc.strip()
 whitespace_only_line = re.compile('^[  DCTB ]+$', re.M)
 doc = whitespace_only_line.sub('', doc)
 doc = CutCommonSpacePrefix(doc)
 doc = re.sub('(?<=\\S)\n(?=\\S)', ' ', doc, re.M)
 return doc

def DocToHelp ( doc ) : doc = doc . strip ( ) whitespace_only_line = re . compile ( '^[  DCTB ]+$' , re . M ) doc = whitespace_only_line . sub ( '' , doc ) doc = CutCommonSpacePrefix ( doc ) doc = re . sub ( '(?<=\\S)\n(?=\\S)' , ' ' , doc , re . M ) return doc
takes a __doc__ string and reformats it as help .