def _create_sbatch(self, ostr):
        """Write sbatch template to output stream
        :param ostr: opened file to write to
        """
        properties = dict(
            sbatch_arguments=self.sbatch_args, hpcbench_command=self.hpcbench_cmd
        )
        try:
            self.sbatch_template.stream(**properties).dump(ostr)
        except jinja2.exceptions.UndefinedError:
            self.logger.error('Error while generating SBATCH template:')
            self.logger.error('%%<--------' * 5)
            for line in self.sbatch_template_str.splitlines():
                self.logger.error(line)
            self.logger.error('%%<--------' * 5)
            self.logger.error('Template properties: %s', properties)
            raise