code: def _init_tk_type():
      """Initialize _tk_type for isXyzTk functions.
  
      This function is only called once, when _tk_type is still None.
      """
      global _tk_type
      if platform == "darwin":
          # When running IDLE, GUI is present, test/* may not be.
          # When running tests, test/* is present, GUI may not be.
          # If not, guess most common.  Does not matter for testing.
          from idlelib.__init__ import testing
  
          if testing:
              from test.support import requires, ResourceDenied
  
              try:
                  requires("gui")
              except ResourceDenied:
                  _tk_type = "cocoa"
                  return
  
          root = tkinter.Tk()
          ws = root.tk.call("tk", "windowingsystem")
          if "x11" in ws:
              _tk_type = "xquartz"
          elif "aqua" not in ws:
              _tk_type = "other"
          elif "AppKit" in root.tk.call("winfo", "server", "."):
              _tk_type = "cocoa"
          else:
              _tk_type = "carbon"
          root.destroy()
      else:
          _tk_type = "other"
      return
  
file_path: cpython/Lib/idlelib/macosx.py
imports: from os.path import expanduser
  import plistlib
  from sys import platform
  import tkinter
label_desc: Use image node_id 1 for calling a global function with example usage: _init_tk_type() without return types