code: def allocate(self, manager=None):
          
          for i, task in enumerate(self):
  
              if not hasattr(task, "manager"):
                  # Set the manager
                  # Use the one provided in input else the one of the work/flow.
                  if manager is not None:
                      task.set_manager(manager)
                  else:
                      # Look first in work and then in the flow.
                      if hasattr(self, "manager"):
                          task.set_manager(self.manager)
                      else:
                          task.set_manager(self.flow.manager)
  
              task_workdir = os.path.join(self.workdir, "t" + str(i))
  
              if not hasattr(task, "workdir"):
                  task.set_workdir(task_workdir)
              else:
                  if task.workdir != task_workdir:
                      raise ValueError("task.workdir != task_workdir: %s, %s" % (task.workdir, task_workdir))
docs: This function is called once we have completed the initialization
          of the :class:`Work`. It sets the manager of each task (if not already done)
          and defines the working directories of the tasks.
  
          Args:
              manager: :class:`TaskManager` object or None