def write_stream_to_file(stream, output):
    header = get_header(stream)
    
    w = None
    if uncompressed in header.soundFormat:
        w = get_wave_for_header(header, output)
    
    for block in stream[1:]:
        block.complete_parse_with_header(header)
        
        if header.soundFormat == consts.AudioCodec.MP3:
            output.write(block.mpegFrames)
        else:
            w.writeframes(block.data.read())
    
    if w:
        w.close()
dataset/ETHPy150Open timknip/pyswf/swf/sound.py/write_stream_to_file/swapped operands of `in`