code: def is_defined_in_class(frames: List[FrameType], obj: Any) -> bool:
      """Check whether a object is defined in a class scope.
  
      Parameters
      ----------
      frames : List[FrameType]
          The frame stack of the object, obtained by `inspect.stack()`.
  
      Returns
      -------
      res : bool
          The result if the object is defined in a class scope.
      """
      if len(frames) > 2:
          frame_info = frames[2]
          code_context = frame_info.code_context
          if code_context is None:
              return False
          line = code_context[0].strip()
          if line.startswith("@") and "ir_module" in line:
              return True
          if line.startswith("class"):
              lineno = frame_info.lineno
              if lineno >= 2:
                  source, _ = findsource(obj)
                  line = source[lineno - 2].strip()
                  if line.startswith("@") and "ir_module" in line:
                      return True
      return False
  
file_path: tvm/python/tvm/script/parser/core/utils.py
imports: import inspect
  from types import FrameType
  from typing import Any, Callable, Dict, List
  from .diagnostics import findsource
label_desc: Use image node_id 4 for calling a global function with example usage: is_defined_in_class(frames, obj) and returns: False, False, True, True