code: def testCAPI(self):
      status = MPI.Status()
      status.source = 0
      status.tag = 1
      status.error = MPI.ERR_OTHER
      extra_objects = [
          status,
          MPI.INT,
          MPI.SUM,
          MPI.INFO_ENV,
          MPI.MESSAGE_NO_PROC,
          MPI.ERRORS_RETURN,
          MPI.GROUP_EMPTY,
          MPI.COMM_SELF,
      ]
  
      pyapi = ctypes.pythonapi
      PyCapsule_GetPointer = pyapi.PyCapsule_GetPointer
      PyCapsule_GetPointer.restype = ctypes.c_void_p
      PyCapsule_GetPointer.argtypes = [
          ctypes.py_object,
          ctypes.c_char_p,
      ]
  
      pyx_capi = MPI.__pyx_capi__
  
      for obj in self.objects + extra_objects:
          cls = type(obj)
          if issubclass(cls, MPI.Comm):
              cls = MPI.Comm
          typename = cls.__name__
          modifier = ""
          if isinstance(obj, MPI.Status):
              mpi_type = ctypes.c_void_p
              modifier = " *"
          elif MPI._sizeof(cls) == ctypes.sizeof(ctypes.c_uint32):
              mpi_type = ctypes.c_uint32
          elif MPI._sizeof(cls) == ctypes.sizeof(ctypes.c_uint64):
              mpi_type = ctypes.c_uint64
  
          new_functype = ctypes.PYFUNCTYPE(ctypes.py_object, mpi_type)
          get_functype = ctypes.PYFUNCTYPE(
              ctypes.c_void_p, ctypes.py_object
          )
          new_capsule = pyx_capi[f"PyMPI{typename}_New"]
          get_capsule = pyx_capi[f"PyMPI{typename}_Get"]
          new_signature = (
              f"PyObject *(MPI_{typename}{modifier})".encode()
          )
          get_signature = f"MPI_{typename} *(PyObject *)".encode()
          PyCapsule_GetPointer.restype = new_functype
          pympi_new = PyCapsule_GetPointer(new_capsule, new_signature)
          PyCapsule_GetPointer.restype = get_functype
          pympi_get = PyCapsule_GetPointer(get_capsule, get_signature)
          PyCapsule_GetPointer.restype = ctypes.c_void_p
  
          objptr = pympi_get(obj)
          if isinstance(obj, MPI.Status):
              newarg = objptr
          else:
              newarg = mpi_type.from_address(objptr).value
          self.assertEqual(objptr, MPI._addressof(obj))
          self.assertEqual(newarg, MPI._handleof(obj))
          newobj = pympi_new(newarg)
          self.assertIs(type(newobj), type(obj))
          self.assertEqual(newobj, obj)
  
imports: from mpi4py import MPI
  import mpiunittest
  import ctypes
  import operator
  import weakref
  import sys
label_desc: Use image node_id 14 for calling the TestObjModel obj's underlying member method code with example usage: obj.testCAPI() without return types