def unwrap_text(text):
    """Turn wrapped text into flowing paragraphs, ready for rewrapping by
    the console, browser, or textwrap.
    """
    all_grafs = []
    cur_graf = []
    for line in text.splitlines():
        line = line.strip()
        if line:
            cur_graf.append(line)
        else:
            all_grafs.append(' '.join(cur_graf))
            cur_graf = []
    if cur_graf:
        all_grafs.append(' '.join(cur_graf))
    return '\n\n'.join(all_grafs)