def get_task_stack(task: asyncio.Task) -> Sequence[FrameType]:
    """Get the annotated stack (if available) on the given task."""

    if safe_hasattr(task, STACK):
        return getattr(task, STACK)
    else:
        # get_stack order is reverse of inspect.stack:
        return task.get_stack()[::-1]
Get the annotated stack (if available) on the given task.
src/core/trulens/core/utils/python.py