def squeeze(text): text = text.rstrip() text = text.lstrip() return ' '.join(re.split(whitespaceRE, text)) return text