def dbus_init(main_loop=True, use_qt_loop=False):
 if (main_loop and (not dbus.get_default_main_loop())):
  if use_qt_loop:
   from dbus.mainloop.pyqt5 import DBusQtMainLoop
   DBusQtMainLoop(set_as_default=True)
  else:
   from dbus.mainloop.glib import DBusGMainLoop
   DBusGMainLoop(set_as_default=True)
 try:
  return dbus.SessionBus()
 except dbus.exceptions.DBusException as e:
  if (e.get_dbus_name() in (DBUS_NOT_SUPPORTED, DBUS_EXEC_FAILED, DBUS_NO_REPLY, DBUS_ACCESS_DENIED)):
   raise SecretServiceNotAvailableException(e.get_dbus_message())
  raise

def dbus_init ( main_loop = True , use_qt_loop = False ) : if ( main_loop and ( not dbus . get_default_main_loop ( ) ) ) : if use_qt_loop : from dbus . mainloop . pyqt5 import DBusQtMainLoop DBusQtMainLoop ( set_as_default = True ) else : from dbus . mainloop . glib import DBusGMainLoop DBusGMainLoop ( set_as_default = True ) try : return dbus . SessionBus ( ) except dbus . exceptions . DBusException as e : if ( e . get_dbus_name ( ) in ( DBUS_NOT_SUPPORTED , DBUS_EXEC_FAILED , DBUS_NO_REPLY , DBUS_ACCESS_DENIED ) ) : raise SecretServiceNotAvailableException ( e . get_dbus_message ( ) ) raise
returns new sessionbus_ .