def _get_line(read_bytes_func):
    """Read bytes using read_bytes_func until a newline byte.

    This isn't particularly efficient, so should only be used when the
    expected size of the line is quite short.

    :returns: a tuple of two strs: (line, excess)
    """
    newline_pos = -1
    bytes = b''
    while newline_pos == -1:
        new_bytes = read_bytes_func(1)
        bytes += new_bytes
        if new_bytes == b'':
            return bytes, b''
        newline_pos = bytes.find(b'\n')
    line = bytes[:newline_pos + 1]
    excess = bytes[newline_pos + 1:]
    return line, excess
