code: def testIsThreadMain(self):
      try:
          flag = MPI.Is_thread_main()
      except NotImplementedError:
          self.skipTest("mpi-is_thread_main")
      name = threading.current_thread().name
      main = (name == "MainThread") or not HAVE_THREADING
      self.assertEqual(flag, main)
      if VERBOSE:
          log = lambda m: sys.stderr.write(m + "\n")
          log(f"{name}: MPI.Is_thread_main() -> {flag}")
  
file_path: mpi4py/test/test_threads.py
imports: import sys
  import mpi4py.rc
  from mpi4py import MPI
  import mpiunittest
label_desc: Use image node_id 2 for calling the TestMPIThreads obj's underlying member method code with example usage: obj.testIsThreadMain() without return types