def _collapse_wspace(text):
 if (text is not None):
  return ' '.join(text.split())

def _collapse_wspace ( text ) : if ( text is not None ) : return ' ' . join ( text . split ( ) )
replace all spans of whitespace with a single space character .