nodes: 0, module; 1, function_definition; 2, function_name:get_scheduler_ordered_list; 3, parameters; 4, block; 5, identifier:self; 6, identifier:realm; 7, expression_statement; 8, comment:# Get the schedulers for the required realm; 9, expression_statement; 10, for_statement; 11, comment:# Now we sort the schedulers so we take alive, then spare, then dead,; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, for_statement; 16, expression_statement; 17, expression_statement; 18, expression_statement; 19, expression_statement; 20, expression_statement; 21, comment:# I need to pop the list, so reverse the list...; 22, return_statement; 23, comment:"""Get sorted scheduler list for a specific realm
  
          List is ordered as: alive first, then spare (if any), then dead scheduler links
  
          :param realm: realm we want scheduler from
          :type realm: alignak.objects.realm.Realm
          :return: sorted scheduler list
          :rtype: list[alignak.objects.schedulerlink.SchedulerLink]
          """; 24, assignment; 25, identifier:scheduler_link_uuid; 26, attribute; 27, block; 28, assignment; 29, assignment; 30, assignment; 31, identifier:sdata; 32, identifier:scheduler_links; 33, block; 34, assignment; 35, call; 36, call; 37, call; 38, call; 39, identifier:scheduler_links; 40, identifier:scheduler_links; 41, list; 42, identifier:realm; 43, identifier:schedulers; 44, expression_statement; 45, identifier:alive; 46, list; 47, identifier:spare; 48, list; 49, identifier:deads; 50, list; 51, if_statement; 52, identifier:scheduler_links; 53, list; 54, attribute; 55, argument_list; 56, attribute; 57, argument_list; 58, attribute; 59, argument_list; 60, attribute; 61, argument_list; 62, call; 63, boolean_operator; 64, block; 65, elif_clause; 66, else_clause; 67, identifier:scheduler_links; 68, identifier:extend; 69, identifier:alive; 70, identifier:scheduler_links; 71, identifier:extend; 72, identifier:spare; 73, identifier:scheduler_links; 74, identifier:extend; 75, identifier:deads; 76, identifier:scheduler_links; 77, identifier:reverse; 78, attribute; 79, argument_list; 80, attribute; 81, not_operator; 82, expression_statement; 83, boolean_operator; 84, block; 85, block; 86, identifier:scheduler_links; 87, identifier:append; 88, subscript; 89, identifier:sdata; 90, identifier:alive; 91, attribute; 92, call; 93, attribute; 94, attribute; 95, expression_statement; 96, expression_statement; 97, attribute; 98, identifier:scheduler_link_uuid; 99, identifier:sdata; 100, identifier:spare; 101, attribute; 102, argument_list; 103, identifier:sdata; 104, identifier:alive; 105, identifier:sdata; 106, identifier:spare; 107, call; 108, call; 109, identifier:self; 110, identifier:schedulers; 111, identifier:alive; 112, identifier:append; 113, identifier:sdata; 114, attribute; 115, argument_list; 116, attribute; 117, argument_list; 118, identifier:spare; 119, identifier:append; 120, identifier:sdata; 121, identifier:deads; 122, identifier:append; 123, identifier:sdata
code: def get_scheduler_ordered_list(self, realm):
          """Get sorted scheduler list for a specific realm
  
          List is ordered as: alive first, then spare (if any), then dead scheduler links
  
          :param realm: realm we want scheduler from
          :type realm: alignak.objects.realm.Realm
          :return: sorted scheduler list
          :rtype: list[alignak.objects.schedulerlink.SchedulerLink]
          """
          # Get the schedulers for the required realm
          scheduler_links = []
          for scheduler_link_uuid in realm.schedulers:
              scheduler_links.append(self.schedulers[scheduler_link_uuid])
  
          # Now we sort the schedulers so we take alive, then spare, then dead,
          alive = []
          spare = []
          deads = []
          for sdata in scheduler_links:
              if sdata.alive and not sdata.spare:
                  alive.append(sdata)
              elif sdata.alive and sdata.spare:
                  spare.append(sdata)
              else:
                  deads.append(sdata)
          scheduler_links = []
          scheduler_links.extend(alive)
          scheduler_links.extend(spare)
          scheduler_links.extend(deads)
  
          scheduler_links.reverse()  # I need to pop the list, so reverse the list...
          return scheduler_links