docs: def create_scheduler_file(scheduler: str, job: Job) -> str:
      """Substitute values into a template scheduler file."""
      logger.debug("Create Scheduler File Function")
  
      if job.scheduler_options is None:
          scheduler_options: Dict[str, Any] = {}
      else:
          scheduler_options = deepcopy(job.scheduler_options)
      try:
          setup_string = parse_setup(scheduler_options["setup"])
          del scheduler_options["setup"]
      except KeyError:
          setup_string = ""
      # Create header
      header_string = create_header_string(scheduler, **scheduler_options)
      header_string += get_array_string(scheduler, len(job))
  
      if scheduler.upper() == "SLURM":
          workdir = r"$SLURM_SUBMIT_DIR"
          array_index = r"$SLURM_ARRAY_TASK_ID"
      elif scheduler.upper() == "PBS":
          workdir = r"$PBS_O_WORKDIR"
          array_index = r"$PBS_ARRAY_INDEX"
  
      return header_string + SCHEDULER_TEMPLATE.format(
          workdir=workdir,
          command_list=job.as_bash_array(),
          setup=setup_string,
          array_index=array_index,
      )