def get_lzw_data_length(lzw_buffer, start=0):
    """Returns the length of a stream of lzw compressed data."""
    lzw_buffer.seek(start + 1)
    blocksize = int.from_bytes(lzw_buffer.read(1), byteorder='little')
    size = blocksize + 2
    while blocksize > 0:
        lzw_buffer.seek(start + size)
        blocksize = lzw_buffer.read(1)
        if not blocksize:
            break
        blocksize = int.from_bytes(blocksize, byteorder='little')
        size += blocksize + 1
    return size
