from textwrap import dedent


def chomptxt(s: str) -> str:
    """
    dedents a triple-quoted indented string, and replaces all single newlines with spaces.
    replaces all double newlines (\\n\\n) with single newlines
    Converts this:
        txt('''
            hello
            world

            here's another
            line
            ''')
    into this:
    `hello world\\nhere's another line`
    """
    res = dedent(s)
    res = res.replace("\n\n", "[PRESERVEDNEWLINE]")
    res = res.replace("\n", " ")
    res = res.replace("[PRESERVEDNEWLINE]", "\n")
    return res.strip()