code: def _write_executor_script(self, ostr):
          
          environment = self.execution.get('environment') or {}
          if not isinstance(environment, Mapping):
              msg = 'Expected mapping for environment but got '
              msg += str(type(environment))
              raise Exception(msg)
          escaped_environment = dict(
              (var, six.moves.shlex_quote(str(value)))
              for var, value in environment.items()
          )
          modules = self.execution.get('modules') or []
          properties = dict(
              command=self.command,
              cwd=os.getcwd(),
              modules=modules,
              environment=escaped_environment,
          )
          self._jinja_executor_template.stream(**properties).dump(ostr)
docs: Write shell script in charge of executing the command