code: def _place_window(w, parent=None):
      w.wm_withdraw()  # Remain invisible while we figure out the geometry
      w.update_idletasks()  # Actualize geometry information
  
      minwidth = w.winfo_reqwidth()
      minheight = w.winfo_reqheight()
      maxwidth = w.winfo_vrootwidth()
      maxheight = w.winfo_vrootheight()
      if parent is not None and parent.winfo_ismapped():
          x = (
              parent.winfo_rootx()
              + (parent.winfo_width() - minwidth) // 2
          )
          y = (
              parent.winfo_rooty()
              + (parent.winfo_height() - minheight) // 2
          )
          vrootx = w.winfo_vrootx()
          vrooty = w.winfo_vrooty()
          x = min(x, vrootx + maxwidth - minwidth)
          x = max(x, vrootx)
          y = min(y, vrooty + maxheight - minheight)
          y = max(y, vrooty)
          if w._windowingsystem == "aqua":
              # Avoid the native menu bar which sits on top of everything.
              y = max(y, 22)
      else:
          x = (w.winfo_screenwidth() - minwidth) // 2
          y = (w.winfo_screenheight() - minheight) // 2
  
      w.wm_maxsize(maxwidth, maxheight)
      w.wm_geometry("+%d+%d" % (x, y))
      w.wm_deiconify()
  
imports: from tkinter import *
  from tkinter import _get_temp_root, _destroy_temp_root
  from tkinter import messagebox
label_desc: Use image node_id 1 for calling a global function with example usage: _place_window(w, parent) without return types