def create(
        self,
        task_name: str,
        task_type: str,
        task_def: TaskDef,
        source: "ConfigPartition",
        parent: Optional["PoeTask.TaskSpec"] = None,
    ) -> "PoeTask.TaskSpec":
        """
        A parent task should be provided when this task is defined inline within another
        task, for example as part of a sequence.
        """
        if not isinstance(task_def, dict):
            task_def = {task_type: task_def}

        return PoeTask.lookup_task_spec_cls(task_type)(
            name=task_name,
            task_def=task_def,
            factory=self,
            source=source,
            parent=parent,
        )

        A parent task should be provided when this task is defined inline within another
        task, for example as part of a sequence.
        
poethepoet/task/base.py