code: def get_traceback_from_context(
      context: dict[str, Any]
  ) -> TracebackType | None:
      """
      Get the traceback object from the context.
      """
      exception = context.get("exception")
      if exception:
          if hasattr(exception, "__traceback__"):
              return cast(TracebackType, exception.__traceback__)
          else:
              # call_exception_handler() is usually called indirectly
              # from an except block. If it's not the case, the traceback
              # is undefined...
              return sys.exc_info()[2]
  
      return None
  
file_path: catboost/contrib/python/prompt-toolkit/py3/prompt_toolkit/eventloop/utils.py
imports: from __future__ import annotations
  import asyncio
  import contextvars
  import sys
  import time
  from asyncio import get_running_loop
  from types import TracebackType
  from typing import Any, Awaitable, Callable, TypeVar, cast
label_desc: Use image node_id 3 for calling a global function with example usage: get_traceback_from_context(context) and returns: None, cast, sys