#NEWLINE# def _GetPrimaryUser( ) : #NEWLINE# #INDENT# 'Returns the str username of the user that has logged in the most.' #NEWLINE# ( return_code , stdout , unused_stderr ) = Exec ( [ '/usr/bin/last' , '-100' ] ) #NEWLINE# if ( ( return_code == 0 ) and stdout ) : #NEWLINE# #INDENT# users = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for line in stdout . splitlines ( ) : #NEWLINE# #INDENT# user = line . split ( ' ' ) [ 0 ] #NEWLINE# users [ user ] = ( users . get ( user , 0 ) + 1 ) #NEWLINE# #UNINDENT# users_list = users . keys ( ) #NEWLINE# users_list . sort ( cmp = ( lambda x , y : cmp ( users [ x ] , users [ y ] ) ) , reverse = True ) #NEWLINE# return users_list [ 0 ] #NEWLINE# #UNINDENT# return ''