def compact_whitespace(s):
 return _MULTI_WHITESPACE.sub(' ', s).strip()

def compact_whitespace ( s ) : return _MULTI_WHITESPACE . sub ( ' ' , s ) . strip ( )
replaces redundant whitespace from strings with a single space .