docstr: Create the writer & save
docstr_tok: ["Create","the","writer","&","save"]
code: def save(self):
      """
      Create the writer & save
      """
      # GH21227 internal compression is not used when file-like passed.
      if self.compression and hasattr(self.path_or_buf, "write"):
          msg = (
              "compression has no effect when passing file-like "
              "object as input."
          )
          warnings.warn(msg, RuntimeWarning, stacklevel=2)
  
      # when zip compression is called.
      is_zip = isinstance(self.path_or_buf, ZipFile) or (
          not hasattr(self.path_or_buf, "write")
          and self.compression == "zip"
      )
  
      if is_zip:
          # zipfile doesn't support writing string to archive. uses string
          # buffer to receive csv writing and dump into zip compression
          # file handle. GH21241, GH21118
          f = StringIO()
          close = False
      elif hasattr(self.path_or_buf, "write"):
          f = self.path_or_buf
          close = False
      else:
          f, handles = _get_handle(
              self.path_or_buf,
              self.mode,
              encoding=self.encoding,
              compression=self.compression,
          )
          close = True
  
      try:
          writer_kwargs = dict(
              lineterminator=self.line_terminator,
              delimiter=self.sep,
              quoting=self.quoting,
              doublequote=self.doublequote,
              escapechar=self.escapechar,
              quotechar=self.quotechar,
          )
          if self.encoding == "ascii":
              self.writer = csvlib.writer(f, **writer_kwargs)
          else:
              writer_kwargs["encoding"] = self.encoding
              self.writer = UnicodeWriter(f, **writer_kwargs)
  
          self._save()
  
      finally:
          if is_zip:
              # GH17778 handles zip compression separately.
              buf = f.getvalue()
              if hasattr(self.path_or_buf, "write"):
                  self.path_or_buf.write(buf)
              else:
                  f, handles = _get_handle(
                      self.path_or_buf,
                      self.mode,
                      encoding=self.encoding,
                      compression=self.compression,
                  )
                  f.write(buf)
                  close = True
          if close:
              f.close()
              for _fh in handles:
                  _fh.close()
  
file_path: catboost/contrib/python/pandas/py2/pandas/io/formats/csvs.py
imports: from __future__ import print_function
  import csv
  import os
  import warnings
  from zipfile import ZipFile
  import numpy
  from pandas._libs import writers
  from pandas.compat import StringIO, range, zip
  from pandas.core.dtypes.generic import ABCDatetimeIndex, ABCIndexClass, ABCMultiIndex, ABCPeriodIndex
  from pandas.core.dtypes.missing import notna
  from pandas import compat
  from pandas.io.common import UnicodeWriter, _get_handle, _infer_compression, get_filepath_or_buffer
label_desc: Use image node_id 2 for calling the CSVFormatter obj's underlying member method code with example usage: obj.save() without return types