code: def raise_last_ffi_error():
      """Raise the previous error from FFI
  
      This should be used instead of `raise get_last_ffi_error()`, as it
      handle propagation of errors across an FFI boundary.  For example,
      if Python passes a callback to a C++ function, and the callback
      raises an exception, the re-thrown exception should contain the
      full stack trace, not just the stack frames that are above the
      outermost FFI call.
      """
  
      _LIB.TVMGetLastPythonError.restype = ctypes.c_void_p
      _LIB.TVMGetLastBacktrace.restype = ctypes.c_char_p
      py_err = _LIB.TVMGetLastPythonError()
      if py_err is None:
          c_err_msg = py_str(_LIB.TVMGetLastError())
          py_err_msg, err_type = c2pyerror(c_err_msg)
          if err_type is not None and err_type.startswith("tvm.error."):
              err_type = err_type[10:]
          py_err = ERROR_TYPE.get(err_type, TVMError)(py_err_msg)
  
      else:
          # TVMGetLastPythonError returns a PyObject*, with NULL when
          # there is no such value.  If we annotated the restype as
          # ctypes.py_object, we would need to return Py_None from the
          # C++ implementation.  This would require introducing a
          # dependency on libpython that we want to avoid when not in a
          # Python environment.  Therefore, casting the resulting void*
          # pointer to PyObject* using ctypes.
          py_err = ctypes.cast(
              ctypes.c_void_p(py_err), ctypes.py_object
          ).value
  
      tb = py_err.__traceback__
  
      # The py_err.__traceback__ only goes from the location thrown
      # up to the next FFI handoff.  To have the stacktrace also
      # include the C++ side, we need to adjust the __traceback__
      # before re-throwing.
      backtrace = _LIB.TVMGetLastBacktrace()
      if backtrace:
          frames = re.split(r"\n\W+\d+:\W+", py_str(backtrace))
          frames = frames[1:]  # Skip "Stack trace: "
  
          for frame in frames:
              if " at " in frame:
                  func_name, frame = frame.split(" at ", 1)
                  if ":" in frame:
                      filename, lineno = frame.rsplit(":", 1)
                      lineno = int(lineno.strip())
                  else:
                      filename = frame
                      lineno = None
                  func_name = func_name.strip()
                  filename = filename.strip()
  
                  tb = _append_traceback_frame(
                      tb, func_name, filename, lineno
                  )
  
      # Remove stack frames that provide little benefit to
      # debugging.  These are only removed from the stack frames
      # contained within the exception we are re-raising, and not to
      # the stack frames that it will continue to collect.
      # Therefore, there may still be a single instance of these
      # frames in the outermost Python-to-FFI call.
      filter_funcs = [
          lambda code: "tvm/_ffi/_ctypes/packed_func.py"
          in code.co_filename,
          lambda code: "tvm/_ffi/base.py" in code.co_filename,
      ]
      tb = _filter_traceback_frames(tb, filter_funcs)
  
      py_err = py_err.with_traceback(tb)
  
      # The exception PyObject may contain a large amount of state,
      # including all stack frames that may be inspected in a later
      # PDB post-mortem.  Therefore, we must make sure to remove the
      # underlying PyObject* from the C++ side after we retrieve it.
      _LIB.TVMDropLastPythonError()
  
      raise py_err
  
imports: import ctypes
  import functools
  import os
  import re
  import sys
  import types
  from typing import Callable, Sequence, Optional
  import numpy
  from .None import libinfo
label_desc: Use image node_id 13 for calling a global function with example usage: raise_last_ffi_error() without return types