def _collapse_whitespace(text):
 return re.sub('\\s+', ' ', text)

def _collapse_whitespace ( text ) : return re . sub ( '\\s+' , ' ' , text )
collapses sequences of whitespace characters in text to a single space .