code: def _write_header(
      path,
      problem_name,
      univariate,
      equal_length,
      series_length,
      class_label,
      fold,
      comment,
  ):
      """Write the header information for a ts file."""
      # create path if not exist
      dirt = f"{str(path)}/{str(problem_name)}/"
      try:
          os.makedirs(dirt)
      except OSError:
          pass  # raises os.error if path already exists
      # create ts file in the path
      file = open(f"{dirt}{str(problem_name)}{fold}.ts", "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")
  
      """ Writes the header info for a ts file"""
      file.write(f"@problemName {problem_name}\n")
      file.write("@timestamps false\n")
      file.write(f"@univariate {str(univariate).lower()}\n")
      file.write(f"@equalLength {str(equal_length).lower()}\n")
      if series_length > 0 and equal_length:
          file.write(f"@seriesLength {series_length}\n")
      # write class label line
      if class_label is not None:
          space_separated_class_label = " ".join(
              str(label) for label in class_label
          )
          file.write(
              f"@classLabel true {space_separated_class_label}\n"
          )
      else:
          file.write("@classLabel false\n")
      file.write("@data\n")
      return file
  
imports: import os
  import textwrap
label_desc: Use image node_id 3 for calling a global function with example usage: _write_header(path, problem_name, univariate, equal_length, series_length, class_label, fold, comment) and returns: file