def create_toolbox(self, filename):
filename = os.path.splitext(filename)[<NUM_LIT:0>]<EOL>label = os.path.basename(filename)<EOL>tool_list = []<EOL>for task in self.tasks:<EOL><INDENT>tool_list.append(task.name)<EOL><DEDENT>file_descriptor = os.open(filename + '<STR_LIT>',<EOL>os.O_WRONLY | os.O_CREAT | os.O_EXCL)<EOL>with os.fdopen(file_descriptor, '<STR_LIT:w>') as self.toolbox_file:<EOL><INDENT>self.toolbox_file.write(self._imports_template.substitute({}))<EOL>toolbox_class = self._toolbox_class_template.substitute(<EOL>{'<STR_LIT:label>': label,<EOL>'<STR_LIT>': self.alias,<EOL>'<STR_LIT>': param_builder.convert_list(tool_list)<EOL>}<EOL>)<EOL>self.toolbox_file.write(toolbox_class)<EOL>for task in self.tasks:<EOL><INDENT>gp_tool = self.create_tool(task)<EOL>self.toolbox_file.write(gp_tool)<EOL>toolbox_help_filename = '<STR_LIT:.>'.join((filename, task.name, '<STR_LIT>', '<STR_LIT>'))<EOL>help_builder.create(toolbox_help_filename, task, self.alias)<EOL><DEDENT><DEDENT>return filename<EOL>
Creates a new Python toolbox where each task name is a GPTool in the toolbox.

:param filename: the filename of the generated toolbox
:param service_name: The name of the ESE service containing the tasks.  Only tasks from
                     one service may be used.
:param tasks: The list of tasks from the service to build as GPTools.