docstr: Prepare to create a batch file
  
  This function is called when CellProfiler is about to create a
  file for batch processing. It will pickle the image set list's
  "legacy_fields" dictionary. This callback lets a module prepare for
  saving.
  
  pipeline - the pipeline to be saved
  image_set_list - the image set list to be saved
  fn_alter_path - this is a function that takes a pathname on the local
                  host and returns a pathname on the remote host. It
                  handles issues such as replacing backslashes and
                  mapping mountpoints. It should be called for every
                  pathname stored in the settings or legacy fields.
  
  ExportToSpreadsheet has to convert the path to file names to
  something that can be used on the cluster.
docstr_tok: ["Prepare","to","create","a","batch","file","This","function","is","called","when","CellProfiler","is","about","to","create","a","file","for","batch","processing",".","It","will","pickle","the","image","set","list's","''","legacy_fields","''","dictionary",".","This","callback","lets","a","module","prepare","for","saving",".","pipeline","-","the","pipeline","to","be","saved","image_set_list","-","the","image","set","list","to","be","saved","fn_alter_path","-","this","is","a","function","that","takes","a","pathname","on","the","local","host","and","returns","a","pathname","on","the","remote","host",".","It","handles","issues","such","as","replacing","backslashes","and","mapping","mountpoints",".","It","should","be","called","for","every","pathname","stored","in","the","settings","or","legacy","fields",".","ExportToSpreadsheet","has","to","convert","the","path","to","file","names","to","something","that","can","be","used","on","the","cluster","."]
code: def prepare_to_create_batch(self, workspace, fn_alter_path):
      """Prepare to create a batch file
  
      This function is called when CellProfiler is about to create a
      file for batch processing. It will pickle the image set list's
      "legacy_fields" dictionary. This callback lets a module prepare for
      saving.
  
      pipeline - the pipeline to be saved
      image_set_list - the image set list to be saved
      fn_alter_path - this is a function that takes a pathname on the local
                      host and returns a pathname on the remote host. It
                      handles issues such as replacing backslashes and
                      mapping mountpoints. It should be called for every
                      pathname stored in the settings or legacy fields.
  
      ExportToSpreadsheet has to convert the path to file names to
      something that can be used on the cluster.
      """
      self.directory.alter_for_create_batch_files(fn_alter_path)
      return True
  
imports: import base64
  import csv
  import logging
  import os
  import numpy
  from cellprofiler_core.constants.image import C_MD5_DIGEST, C_SCALING, C_HEIGHT, C_WIDTH
  from cellprofiler_core.constants.measurement import EXPERIMENT, IMAGE, AGG_MEAN, AGG_MEDIAN, AGG_STD_DEV, C_URL, C_PATH_NAME, C_FILE_NAME, NEIGHBORS, R_FIRST_IMAGE_NUMBER, R_SECOND_IMAGE_NUMBER, R_FIRST_OBJECT_NUMBER, R_SECOND_OBJECT_NUMBER
  from cellprofiler_core.constants.module import IO_FOLDER_CHOICE_HELP_TEXT, IO_WITH_METADATA_HELP_TEXT, USING_METADATA_HELP_REF, USING_METADATA_TAGS_REF
  from cellprofiler_core.constants.pipeline import EXIT_STATUS
  from cellprofiler_core.measurement import Measurements
  from cellprofiler_core.module import Module
  from cellprofiler_core.preferences import ABSOLUTE_FOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_INPUT_FOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_INPUT_SUBFOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_OUTPUT_FOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_OUTPUT_SUBFOLDER_NAME
  from cellprofiler_core.preferences import get_headless
  from cellprofiler_core.setting import Binary
  from cellprofiler_core.setting import Divider
  from cellprofiler_core.setting import Measurement
  from cellprofiler_core.setting import SettingsGroup
  from cellprofiler_core.setting import ValidationError
  from cellprofiler_core.setting.choice import CustomChoice, Choice
  from cellprofiler_core.setting.do_something import DoSomething, RemoveSettingButton
  from cellprofiler_core.setting.multichoice import MeasurementMultiChoice
  from cellprofiler_core.setting.subscriber import ImageSubscriber, LabelSubscriber
  from cellprofiler_core.setting.text import Directory, Text
  from cellprofiler_core.utilities.core.modules.load_data import is_file_name_feature, is_path_name_feature
  from cellprofiler_core.utilities.measurement import find_metadata_tokens, get_agg_measurement_name
  from cellprofiler.gui.help.content import MEASUREMENT_NAMING_HELP
label_desc: Use image node_id 30 for calling the ExportToSpreadsheet obj's underlying member method code with example usage: obj.prepare_to_create_batch(workspace, fn_alter_path) and returns: True