code: def require_Gtk(min_version=2):
      
      if not _in_X:
          raise RuntimeError('Not in X session.')
      if _has_Gtk < min_version:
          raise RuntimeError('Module gi.repository.Gtk not available!')
      if _has_Gtk == 2:
          logging.getLogger(__name__).warn(
              _("Missing runtime dependency GTK 3. Falling back to GTK 2 "
                "for password prompt"))
      from gi.repository import Gtk
      # if we attempt to create any GUI elements with no X server running the
      # program will just crash, so let's make a way to catch this case:
      if not Gtk.init_check(None)[0]:
          raise RuntimeError(_("X server not connected!"))
      return Gtk
docs: Make sure Gtk is properly initialized.
  
      :raises RuntimeError: if Gtk can not be properly initialized