code: def write_data_csv(fname, frames, preproc):
     
     fdata = open(fname, "w")
     dr = Parallel()(delayed(get_data)(lst,preproc) for lst in frames)
     data,result = zip(*dr)
     for entry in data:
        fdata.write(','.join(entry)+'\r\n')
     print("All finished, %d slices in total" % len(data))
     fdata.close()
     result = np.ravel(result)
     return result
docs: Write data to csv file