def _write_csv(filepath, data, kwargs):
    """See documentation of mpu.io.write."""
    kwargs_open = {'newline': ''}
    mode = 'w'
    if sys.version_info < (3, 0):
        kwargs_open.pop('newline', None)
        mode = 'wb'
    with open(filepath, mode, **kwargs_open) as fp:
        if 'delimiter' not in kwargs:
            kwargs['delimiter'] = ','
        if 'quotechar' not in kwargs:
            kwargs['quotechar'] = '"'
        with open(filepath, 'w') as fp:
            writer = csv.writer(fp, **kwargs)
            writer.writerows(data)
    return data
def _write_csv ( filepath , data , kwargs ) : kwargs_open = { 'newline' : '' } mode = 'w' if sys . version_info < ( 3 , 0 ) : kwargs_open . pop ( 'newline' , None ) mode = 'wb' with open ( filepath , mode , ** kwargs_open ) as fp : if 'delimiter' not in kwargs : kwargs [ 'delimiter' ] = ',' if 'quotechar' not in kwargs : kwargs [ 'quotechar' ] = '"' with open ( filepath , 'w' ) as fp : writer = csv . writer ( fp , ** kwargs ) writer . writerows ( data ) return data
See documentation of mpu.io.write.