code: def _write_submit_script(self, template, script_filename, job_name, configs):
          
  
          try:
              submit_script = Template(template).substitute(jobname=job_name, **configs)
              # submit_script = Template(template).safe_substitute(jobname=job_name, **configs)
              with open(script_filename, 'w') as f:
                  f.write(submit_script)
  
          except KeyError as e:
              logger.error("Missing keys for submit script : %s", e)
              raise (SchedulerMissingArgs(e.args, self.sitename))
  
          except IOError as e:
              logger.error("Failed writing to submit script: %s", script_filename)
              raise (ScriptPathError(script_filename, e))
          except Exception as e:
              print("Template : ", template)
              print("Args : ", job_name)
              print("Kwargs : ", configs)
              logger.error("Uncategorized error: %s", e)
              raise (e)
  
          return True
docs: 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