code: def _save_header(self):
      writer = self.writer
      obj = self.obj
      index_label = self.index_label
      cols = self.cols
      has_mi_columns = self.has_mi_columns
      header = self.header
      encoded_labels = []
  
      has_aliases = isinstance(
          header, (tuple, list, np.ndarray, ABCIndexClass)
      )
      if not (has_aliases or self.header):
          return
      if has_aliases:
          if len(header) != len(cols):
              raise ValueError(
                  (
                      "Writing {ncols} cols but got {nalias} "
                      "aliases".format(
                          ncols=len(cols), nalias=len(header)
                      )
                  )
              )
          else:
              write_cols = header
      else:
          write_cols = cols
  
      if self.index:
          # should write something for index label
          if index_label is not False:
              if index_label is None:
                  if isinstance(obj.index, ABCMultiIndex):
                      index_label = []
                      for i, name in enumerate(obj.index.names):
                          if name is None:
                              name = ""
                          index_label.append(name)
                  else:
                      index_label = obj.index.name
                      if index_label is None:
                          index_label = [""]
                      else:
                          index_label = [index_label]
              elif not isinstance(
                  index_label, (list, tuple, np.ndarray, ABCIndexClass)
              ):
                  # given a string for a DF with Index
                  index_label = [index_label]
  
              encoded_labels = list(index_label)
          else:
              encoded_labels = []
  
      if not has_mi_columns or has_aliases:
          encoded_labels += list(write_cols)
          writer.writerow(encoded_labels)
      else:
          # write out the mi
          columns = obj.columns
  
          # write out the names for each level, then ALL of the values for
          # each level
          for i in range(columns.nlevels):
              # we need at least 1 index column to write our col names
              col_line = []
              if self.index:
                  # name is the first column
                  col_line.append(columns.names[i])
  
                  if (
                      isinstance(index_label, list)
                      and len(index_label) > 1
                  ):
                      col_line.extend([""] * (len(index_label) - 1))
  
              col_line.extend(columns._get_level_values(i))
  
              writer.writerow(col_line)
  
          # Write out the index line if it's not empty.
          # Otherwise, we will print out an extraneous
          # blank line between the mi and the data rows.
          if encoded_labels and set(encoded_labels) != {""}:
              encoded_labels.extend([""] * len(columns))
              writer.writerow(encoded_labels)
  
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 3 for calling the CSVFormatter obj's underlying member method code with example usage: obj._save_header() without return types