def csvwrite(inlist, stringify=False):
 out_list = []
 for entry in inlist:
  if stringify:
   new_entry = []
   for val in entry:
    if (not isinstance(val, basestring)):
     val = str(val)
    new_entry.append(val)
   entry = new_entry
  this_line = ', '.join([elem_quote(val) for val in entry])
  out_list.append(this_line)
 return out_list

def csvwrite ( inlist , stringify = False ) : out_list = [ ] for entry in inlist : if stringify : new_entry = [ ] for val in entry : if ( not isinstance ( val , basestring ) ) : val = str ( val ) new_entry . append ( val ) entry = new_entry this_line = ', ' . join ( [ elem_quote ( val ) for val in entry ] ) out_list . append ( this_line ) return out_list
given a list of lists it turns each entry into a line in a csv .