def _sync_children(self, task_specs, state=MAYBE):
LOG.debug("<STR_LIT>" % self.get_name())<EOL>if task_specs is None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>add = task_specs[:]<EOL>remove = []<EOL>for child in self.children:<EOL><INDENT>if child.triggered:<EOL><INDENT>continue<EOL><DEDENT>if child.task_spec in add:<EOL><INDENT>add.remove(child.task_spec)<EOL>continue<EOL><DEDENT>if child._is_definite():<EOL><INDENT>raise WorkflowException(self.task_spec,<EOL>'<STR_LIT>' %<EOL>repr(child))<EOL><DEDENT>remove.append(child)<EOL><DEDENT>for child in remove:<EOL><INDENT>self.children.remove(child)<EOL><DEDENT>for task_spec in add:<EOL><INDENT>self._add_child(task_spec, state)<EOL><DEDENT>
This method syncs up the task's children with the given list of task
specs. In other words::

    - Add one child for each given TaskSpec, unless that child already
      exists.
    - Remove all children for which there is no spec in the given list,
      unless it is a "triggered" task.

.. note::

   It is an error if the task has a non-predicted child that is
   not given in the TaskSpecs.

:type  task_specs: list(TaskSpec)
:param task_specs: The list of task specs that may become children.
:type  state: integer
:param state: The bitmask of states for the new children.