code: def _assign_new_thread_id(self, recursive=True):
          
          self.__class__.thread_id_pool += 1
          self.thread_id = self.__class__.thread_id_pool
          if not recursive:
              return self.thread_id
          for child in self:
              child.thread_id = self.thread_id
          return self.thread_id
docs: Assigns a new thread id to the task.
  
          :type  recursive: bool
          :param recursive: Whether to assign the id to children recursively.
          :rtype:  bool
          :returns: The new thread id.