def task_factory_with_stack(loop, coro, *args, **kwargs) -> asyncio.Task:
    """A task factory that annotates created tasks with stacks and context of
    their parents.

    All of such annotated stacks can be retrieved with
    [stack_with_tasks][trulens.core.utils.python.stack_with_tasks] as one merged
    stack.
    """

    if "context" in kwargs:
        logger.warning(
            "Context is being overwritten, TruLens may not be able to record traces."
        )

    parent_task = asyncio.current_task(loop=loop)
    task = asyncio.tasks.Task(coro=coro, loop=loop, *args, **kwargs)

    frame = inspect.currentframe()
    stack = stack_generator(frame=frame, offset=3)

    if parent_task is not None:
        stack = merge_stacks(stack, parent_task.get_stack()[::-1])
        # skipping create_task and task_factory

    setattr(task, STACK, stack)

    return task
A task factory that annotates created tasks with stacks and context of
    their parents.

    All of such annotated stacks can be retrieved with
    [stack_with_tasks][trulens.core.utils.python.stack_with_tasks] as one merged
    stack.
    
src/core/trulens/core/utils/python.py