def _parse_dbus_locale():
 bus = dbus.SystemBus()
 localed = bus.get_object('org.freedesktop.locale1', '/org/freedesktop/locale1')
 properties = dbus.Interface(localed, 'org.freedesktop.DBus.Properties')
 system_locale = properties.Get('org.freedesktop.locale1', 'Locale')
 ret = {}
 for env_var in system_locale:
  match = re.match('^([A-Z_]+)=(.*)$', env_var)
  if match:
   ret[match.group(1)] = match.group(2).replace('"', '')
  else:
   log.error('Odd locale parameter "{0}" detected in dbus locale output. This should not happen. You should probably investigate what caused this.'.format(env_var))
 return ret

def _parse_dbus_locale ( ) : bus = dbus . SystemBus ( ) localed = bus . get_object ( 'org.freedesktop.locale1' , '/org/freedesktop/locale1' ) properties = dbus . Interface ( localed , 'org.freedesktop.DBus.Properties' ) system_locale = properties . Get ( 'org.freedesktop.locale1' , 'Locale' ) ret = { } for env_var in system_locale : match = re . match ( '^([A-Z_]+)=(.*)$' , env_var ) if match : ret [ match . group ( 1 ) ] = match . group ( 2 ) . replace ( '"' , '' ) else : log . error ( 'Odd locale parameter "{0}" detected in dbus locale output. This should not happen. You should probably investigate what caused this.' . format ( env_var ) ) return ret
get the system locale parameters from dbus .