def open_session(bus):
 service_obj = bus_get_object(bus, SS_PATH)
 service_iface = dbus.Interface(service_obj, (SS_PREFIX + 'Service'))
 session = Session()
 try:
  (output, result) = service_iface.OpenSession(ALGORITHM_DH, dbus.ByteArray(int_to_bytes(session.my_public_key)), signature='sv')
 except dbus.exceptions.DBusException as e:
  if (e.get_dbus_name() != DBUS_NOT_SUPPORTED):
   raise
  (output, result) = service_iface.OpenSession(ALGORITHM_PLAIN, '', signature='sv')
  session.encrypted = False
 else:
  output = int_from_bytes(bytearray(output), 'big')
  session.set_server_public_key(output)
 session.object_path = result
 return session

def open_session ( bus ) : service_obj = bus_get_object ( bus , SS_PATH ) service_iface = dbus . Interface ( service_obj , ( SS_PREFIX + 'Service' ) ) session = Session ( ) try : ( output , result ) = service_iface . OpenSession ( ALGORITHM_DH , dbus . ByteArray ( int_to_bytes ( session . my_public_key ) ) , signature = 'sv' ) except dbus . exceptions . DBusException as e : if ( e . get_dbus_name ( ) != DBUS_NOT_SUPPORTED ) : raise ( output , result ) = service_iface . OpenSession ( ALGORITHM_PLAIN , '' , signature = 'sv' ) session . encrypted = False else : output = int_from_bytes ( bytearray ( output ) , 'big' ) session . set_server_public_key ( output ) session . object_path = result return session
returns a new secret service session .