<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_toolbox(self, filename):
 """ 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. """

        filename = os.path.splitext(filename)[0]
        label = os.path.basename(filename)

        # Get task information first so we can build the tool list
        tool_list = []
        for task in self.tasks:
            tool_list.append(task.name)

        file_descriptor = os.open(filename + '.pyt',
                                  os.O_WRONLY | os.O_CREAT | os.O_EXCL)
        with os.fdopen(file_descriptor, 'w') as self.toolbox_file:
            self.toolbox_file.write(self._imports_template.substitute({}))
            toolbox_class = self._toolbox_class_template.substitute(
                {'label': label,
                 'alias': self.alias,
                 'toolList': param_builder.convert_list(tool_list)
                }
            )
            self.toolbox_file.write(toolbox_class)

            for task in self.tasks:
                gp_tool = self.create_tool(task)
                self.toolbox_file.write(gp_tool)
                toolbox_help_filename = '.'.join((filename, task.name, 'pyt', 'xml'))
                help_builder.create(toolbox_help_filename, task, self.alias)

        return filename