code: def _add_child(self, task_spec, state=MAYBE):
          
          if task_spec is None:
              raise ValueError(self, '_add_child() requires a TaskSpec')
          if self._is_predicted() and state & self.PREDICTED_MASK == 0:
              msg = 'Attempt to add non-predicted child to predicted task'
              raise WorkflowException(self.task_spec, msg)
          task = Task(self.workflow, task_spec, self, state=state)
          task.thread_id = self.thread_id
          if state == self.READY:
              task._ready()
          return task
docs: Adds a new child and assigns the given TaskSpec to it.
  
          :type  task_spec: TaskSpec
          :param task_spec: The task spec that is assigned to the new child.
          :type  state: integer
          :param state: The bitmask of states for the new child.
          :rtype:  Task
          :returns: The new child task.