def compact(text, **kw):
    return '\n\n'.join(' '.join(p.split()) for p in text.split('\n\n')).format(**kw)
Compact whitespace in a string and format any keyword arguments into the string.
dataset/ETHPy150Open paylogic/pip-accel/pip_accel/utils.py/compact