code: def order_available_hosts(
      available_hosts, prev_host_assignment_order
  ):
      # We need to ensure this list preserves relative order to ensure the oldest hosts are assigned lower ranks.
      host_assignment_order = [
          host
          for host in prev_host_assignment_order
          if host in available_hosts
      ]
      known_hosts = set(host_assignment_order)
      for host in available_hosts:
          if host not in known_hosts:
              host_assignment_order.append(host)
      return host_assignment_order
  
imports: import io
  import logging
  import random
  import threading
  import time
  from collections import defaultdict
  from horovod.runner.common.util import safe_shell_exec
  from horovod.runner.elastic.worker import HostUpdateResult
label_desc: Use image node_id 7 for calling the HostManager obj's underlying member method code with example usage: obj.order_available_hosts(available_hosts, prev_host_assignment_order) and returns: host_assignment_order