def write_tmp_csv_file(csv_data, sli_manifest):
    '''Write a CSV temporary file with values in csv_data - list of dicts.
    
    @param csv_data: list of dicts
    @param sli_manifest: json sli_manifest
    '''
    fieldnames = [part['columnName'] for part in sli_manifest['dataSetSLIManifest']['parts']]
    fp, filename = mkstemp()
    file = open(filename, 'w+b')
    writer = csv.DictWriter(file, fieldnames=fieldnames,
                            delimiter=sli_manifest['dataSetSLIManifest']['csvParams']['separatorChar'],
                            quotechar=sli_manifest['dataSetSLIManifest']['csvParams']['quoteChar'],
                            quoting=csv.QUOTE_ALL)
    headers = dict((n, n) for n in fieldnames)
    writer.writerow(headers)
    for line in csv_data:
        for key in fieldnames:
            #some incredible magic with additional date field
            if not key in line and key.endswith('_dt'):
                h = hashlib.md5()
                #h.update(line[key[:-3]])
                h.update('123456')
                line[key] = h.hexdigest()[:6]
            #formatting the date properly
            if isinstance(line[key], datetime.datetime):
                line[key] = line[key].strftime("%Y-%m-%d")
            #make 0/1 from bool
            if isinstance(line[key], bool):
                line[key] = int(line[key])
        writer.writerow(line)
    os.close(fp)
    return filename
dataset/ETHPy150Open comoga/gooddata-python/gooddataclient/archiver.py/write_tmp_csv_file/original