def collapse_whitespace(message):
    return u' '.join(map(lambda s: s.strip(),
                         filter(None, message.strip().splitlines())))
Collapses consecutive whitespace into a single space
dataset/ETHPy150Open mozilla/puente/puente/utils.py/collapse_whitespace