def _find_utmp():
 result = {}
 for utmp in ('/var/run/utmp', '/run/utmp'):
  try:
   result[os.stat(utmp).st_mtime] = utmp
  except Exception:
   pass
 return result[sorted(result).pop()]

def _find_utmp ( ) : result = { } for utmp in ( '/var/run/utmp' , '/run/utmp' ) : try : result [ os . stat ( utmp ) . st_mtime ] = utmp except Exception : pass return result [ sorted ( result ) . pop ( ) ]
figure out which utmp file to use when determining runlevel .