Given a byte stream with reader, yield chunks of block_size
    until the stream is consusmed.

def read_chunks(stream, block_size=2**10):
    """
    Given a byte stream with reader, yield chunks of block_size
    until the stream is consusmed.
    """
    while True:
        chunk = stream.read(block_size)
        if not chunk:
            break
        yield chunk