def join_nonempty_lines(lines: Iterable[Optional[str]]) -> str:
    return '\n'.join(filter(None, (line.strip() for line in lines if line)))
def join_nonempty_lines(lines: Iterable[Optional[str]]) -> str:
    return '\n'.join(filter(None, (line.strip() for line in lines if line)))