def check_order(group):
 global skip_order_check
 try:
  if (skip_order_check or (len(group) < 2)):
   skip_order_check = False
   return
  if any(((group[0][0] != labels[0]) for labels in group)):
   warning('Domain group TLD is not consistent')
  sorted_group = sorted(group, key=(lambda labels: (len(labels), psl_key(labels[(-1)][0]), labels)))
  if (group != sorted_group):
   warning('Incorrectly sorted group of domains')
   print ('  ' + str(group))
   print ('  ' + str(sorted_group))
   print 'Correct sorting would be:'
   print_psl(sorted_group)
 finally:
  del group[:]

def check_order ( group ) : global skip_order_check try : if ( skip_order_check or ( len ( group ) < 2 ) ) : skip_order_check = False return if any ( ( ( group [ 0 ] [ 0 ] != labels [ 0 ] ) for labels in group ) ) : warning ( 'Domain group TLD is not consistent' ) sorted_group = sorted ( group , key = ( lambda labels : ( len ( labels ) , psl_key ( labels [ ( - 1 ) ] [ 0 ] ) , labels ) ) ) if ( group != sorted_group ) : warning ( 'Incorrectly sorted group of domains' ) print ( '  ' + str ( group ) ) print ( '  ' + str ( sorted_group ) ) print 'Correct sorting would be:' print_psl ( sorted_group ) finally : del group [ : ]
check the correct order of a domain group .