code: def write_tabular_transformation_to_arff(
      data,
      transformation,
      path,
      problem_name="sample_data",
      class_label=None,
      class_value_list=None,
      comment=None,
      fold="",
      fit_transform=True,
  ):
      """Transform dataset using a tabular transformer and write the result to arff file.
  
      Parameters
      ----------
      data: pandas dataframe or 3d numpy array
          The dataset to build the transformation with which must be of the structure
          specified in the documentation examples/loading_data.ipynb.
      transformation: BaseTransformer
          Transformation use and to save to arff.
      path: str
          The full path to output the arff file to.
      problem_name: str, default="sample_data"
          The problemName to print in the header of the arff file and also the name of
          the file.
      class_label: list of str or None, default=None
          The problems class labels to show the possible class values for in the file
          header, optional.
      class_value_list: list, ndarray or None, default=None
          The class values for each case, optional.
      comment: str or None, default=None
          Comment text to be inserted before the header in a block.
      fold: str or None, default=None
          Addon at the end of the filename, i.e. _TRAIN or _TEST.
      fit_transform: bool, default=True
          Whether to fit the transformer prior to calling transform.
  
      Returns
      -------
      None
      """
      # ensure transformation provided is a transformer
      if not isinstance(transformation, BaseTransformer):
          raise ValueError("Transformation must be a BaseTransformer")
      if fit_transform:
          data = transformation.fit_transform(data, class_value_list)
      else:
          data = transformation.transform(data, class_value_list)
      if isinstance(data, pd.DataFrame):
          data = data.to_numpy()
      if class_value_list is not None and class_label is None:
          class_label = np.unique(class_value_list)
      elif class_value_list is None:
          class_value_list = []
      # ensure number of cases is same as the class value list
      if (
          len(data) != len(class_value_list)
          and len(class_value_list) > 0
      ):
          raise IndexError(
              "The number of cases is not the same as the number of given class values"
          )
      if fold is None:
          fold = ""
      # create path if not exist
      dirt = f"{str(path)}/{str(problem_name)}-{type(transformation).__name__}/"
      try:
          os.makedirs(dirt)
      except OSError:
          pass  # raises os.error if path already exists
      # create arff file in the path
      file = open(
          f"{dirt}{str(problem_name)}-{type(transformation).__name__}{fold}.arff",
          "w",
      )
      # write comment if any as a block at start of file
      if comment is not None:
          file.write("\n% ".join(textwrap.wrap("% " + comment)))
          file.write("\n")
      # begin writing header information
      file.write(f"@Relation {problem_name}\n")
      # write each attribute
      for i in range(data.shape[1]):
          file.write(f"@attribute att{str(i)} numeric\n")
      # write class attribute if it exists
      if class_label is not None:
          comma_separated_class_label = ",".join(
              str(label) for label in class_label
          )
          file.write(
              f"@attribute target {{{comma_separated_class_label}}}\n"
          )
      file.write("@data\n")
      for case, value in itertools.zip_longest(data, class_value_list):
          # turn attributes into comma-separated row
          atts = ",".join(
              [str(num) if not np.isnan(num) else "?" for num in case]
          )
          file.write(str(atts))
          if value is not None:
              file.write(f",{value}")  # write the case value if any
          elif class_label is not None:
              file.write(",?")
          file.write("\n")  # open a new line
      file.close()
  
imports: import itertools
  import os
  import textwrap
  import numpy
  import pandas
  from sktime.transformations.base import BaseTransformer
label_desc: Use image node_id 2 for calling a global function with example usage: write_tabular_transformation_to_arff(data, transformation, path, problem_name, class_label, class_value_list, comment, fold, fit_transform) without return types