from typing import List


def ok(lines: List[str], join_on_newline: bool = True) -> bytes:
    """Send the given lines to stdout, preceded by a 20 (success) \
            response.

    :param lines: List of lines to send to stdout.
    :param join_on_newline: Whether to join `lines` on newlines, or an \
            empty string. Should be False if each line in `lines` \
            already has a newline at the end.
    :return: Bytes to be sent to the client.

    """
    if join_on_newline:
        content = '\n'.join(lines)
    else:
        content = ''.join(lines)

    return f'20 text/gemini\r\n{content}\n'.encode()