code: def _generate_multiindex_header_rows(
      self,
  ) -> Iterator[list[Hashable]]:
      columns = self.obj.columns
      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(self.index_label, list)
                  and len(self.index_label) > 1
              ):
                  col_line.extend([""] * (len(self.index_label) - 1))
  
          col_line.extend(columns._get_level_values(i))
          yield 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 self.encoded_labels and set(self.encoded_labels) != {""}:
          yield self.encoded_labels + [""] * len(columns)
  
imports: from __future__ import annotations
  import csv
  import os
  from typing import TYPE_CHECKING, Any, Hashable, Iterator, Sequence, cast
  import numpy
  from pandas._libs import writers
  from pandas._typing import CompressionOptions, FilePath, FloatFormatType, IndexLabel, StorageOptions, WriteBuffer
  from pandas.util._decorators import cache_readonly
  from pandas.core.dtypes.generic import ABCDatetimeIndex, ABCIndex, ABCMultiIndex, ABCPeriodIndex
  from pandas.core.dtypes.missing import notna
  from pandas.core.indexes.api import Index
  from pandas.io.common import get_handle
label_desc: Use image node_id 25 for calling the CSVFormatter obj's underlying member method code with example usage: obj._generate_multiindex_header_rows() without return types