def max_min_read_lengths_from_fastq_stream(fastq_stream):
    """ Grabs maximum and minimum read lengths from a FASTQ stream.

        fastq_stream: input fastq stream

        Return value: tuple (max read length, min read length)
    """
    max_len, min_len = 0, 1000000000
    for i, line in enumerate(fastq_stream):
        if (i - 1) % 4 == 0:
            max_len = max(max_len, len(line.strip()))
            min_len = min(min_len, len(line.strip()))
    return max_len, min_len