def _write_submit_script(self, template, script_filename, job_name, configs):
try:<EOL><INDENT>submit_script = Template(template).substitute(jobname=job_name, **configs)<EOL>with open(script_filename, '<STR_LIT:w>') as f:<EOL><INDENT>f.write(submit_script)<EOL><DEDENT><DEDENT>except KeyError as e:<EOL><INDENT>logger.error("<STR_LIT>", e)<EOL>raise (SchedulerMissingArgs(e.args, self.sitename))<EOL><DEDENT>except IOError as e:<EOL><INDENT>logger.error("<STR_LIT>", script_filename)<EOL>raise (ScriptPathError(script_filename, e))<EOL><DEDENT>except Exception as e:<EOL><INDENT>print("<STR_LIT>", template)<EOL>print("<STR_LIT>", job_name)<EOL>print("<STR_LIT>", configs)<EOL>logger.error("<STR_LIT>", e)<EOL>raise (e)<EOL><DEDENT>return True<EOL>
Generate submit script and write it to a file.

        Args:
              - template (string) : The template string to be used for the writing submit script
              - script_filename (string) : Name of the submit script
              - job_name (string) : job name
              - configs (dict) : configs that get pushed into the template

        Returns:
              - True: on success

        Raises:
              SchedulerMissingArgs : If template is missing args
              ScriptPathError : Unable to write submit script out