def _ReorderHandlers(handler_list):
 for (i, j) in itertools.combinations(xrange(len(handler_list)), 2):
  if handler_list[i].MatchesAll(handler_list[j]):
   (handler_list[i], handler_list[j]) = (handler_list[j], handler_list[i])

def _ReorderHandlers ( handler_list ) : for ( i , j ) in itertools . combinations ( xrange ( len ( handler_list ) ) , 2 ) : if handler_list [ i ] . MatchesAll ( handler_list [ j ] ) : ( handler_list [ i ] , handler_list [ j ] ) = ( handler_list [ j ] , handler_list [ i ] )
reorders handlers from specific to general for writing to yaml file .