#NEWLINE# def get_last_controller( self , nodes ) : #NEWLINE# #INDENT# sorted_nodes = sorted ( nodes , key = ( lambda node : int ( node [ 'uid' ] ) ) ) #NEWLINE# controller_nodes = self . filter_by_roles ( sorted_nodes , [ 'controller' , 'primary-controller' ] ) #NEWLINE# last_controller = None #NEWLINE# if ( len ( controller_nodes ) > 0 ) : #NEWLINE# #INDENT# last_controller = controller_nodes [ ( - 1 ) ] [ 'name' ] #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# 'last_controller' : last_controller , #NEWLINE# #UNINDENT# }