code: def _setupAutoDeployment(self, userScript=None):
          
          if userScript is not None:
              # This branch is hit when a workflow is being started
              if userScript.belongsToToil:
                  logger.debug('User script %s belongs to Toil. No need to auto-deploy it.', userScript)
                  userScript = None
              else:
                  if (self._batchSystem.supportsAutoDeployment() and
                          not self.config.disableAutoDeployment):
                      # Note that by saving the ModuleDescriptor, and not the Resource we allow for
                      # redeploying a potentially modified user script on workflow restarts.
                      with self._jobStore.writeSharedFileStream('userScript') as f:
                          pickle.dump(userScript, f, protocol=pickle.HIGHEST_PROTOCOL)
                  else:
                      from toil.batchSystems.singleMachine import SingleMachineBatchSystem
                      if not isinstance(self._batchSystem, SingleMachineBatchSystem):
                          logger.warn('Batch system does not support auto-deployment. The user '
                                      'script %s will have to be present at the same location on '
                                      'every worker.', userScript)
                      userScript = None
          else:
              # This branch is hit on restarts
              from toil.jobStores.abstractJobStore import NoSuchFileException
              try:
                  with self._jobStore.readSharedFileStream('userScript') as f:
                      userScript = safeUnpickleFromStream(f)
              except NoSuchFileException:
                  logger.debug('User script neither set explicitly nor present in the job store.')
                  userScript = None
          if userScript is None:
              logger.debug('No user script to auto-deploy.')
          else:
              logger.debug('Saving user script %s as a resource', userScript)
              userScriptResource = userScript.saveAsResourceTo(self._jobStore)
              logger.debug('Injecting user script %s into batch system.', userScriptResource)
              self._batchSystem.setUserScript(userScriptResource)
docs: Determine the user script, save it to the job store and inject a reference to the saved
          copy into the batch system such that it can auto-deploy the resource on the worker
          nodes.
  
          :param toil.resource.ModuleDescriptor userScript: the module descriptor referencing the
                 user script. If None, it will be looked up in the job store.