code: def tocsv(table, source=None, encoding=None, errors='strict', write_header=True,
            **csvargs):
      
  
      source = write_source_from_arg(source)
      csvargs.setdefault('dialect', 'excel')
      tocsv_impl(table, source=source, encoding=encoding, errors=errors,
                 write_header=write_header, **csvargs)
docs: Write the table to a CSV file. E.g.::
  
          >>> import petl as etl
          >>> table1 = [['foo', 'bar'],
          ...           ['a', 1],
          ...           ['b', 2],
          ...           ['c', 2]]
          >>> etl.tocsv(table1, 'example.csv')
          >>> # look what it did
          ... print(open('example.csv').read())
          foo,bar
          a,1
          b,2
          c,2
  
      The `source` argument is the path of the delimited file, and the optional
      `write_header` argument specifies whether to include the field names in the
      delimited file.  All other keyword arguments are passed to
      :func:`csv.writer`. So, e.g., to override the delimiter from the default
      CSV dialect, provide the `delimiter` keyword argument.
  
      Note that if a file already exists at the given location, it will be
      overwritten.