code: def get_scheduler_ordered_list(self, realm):
          
          # 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
docs: 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]