@classmethod
  def GetIdleInstanceIpAddress(cls):
    all_infos = cls.GetAll()
    candidates = []
    # At least CANDIDATE_MIN_SIZE instances are added to candidates.
    # After that, if the instance's load is the same as the last candidate's
    # load, the instance is added to candidates.
    for info in sorted(all_infos.values(),
                       key=lambda x: x.get(cls.LOAD, 10000)):
      if cls.LOAD not in info:
        break
      if len(candidates) < cls.CANDIDATE_MIN_SIZE:
        candidates.append(info)
        last_load = info[cls.LOAD]
      else:
        if info[cls.LOAD] == last_load:
          candidates.append(info)
        else:
          break
    # If candidates are empty, we cannot return anything.
    if not candidates:
      return None
    # Return IP address of one of the candidates randomly.
    return candidates[random.randint(0, len(candidates) - 1)][cls.IP_ADDRESS]
Flags:
dataset/ETHPy150Open GoogleCloudPlatform/solutions-load-balanced-gaming-server-on-google-compute-engine/load_info.py/LoadInfo.GetIdleInstanceIpAddress--crossover with--dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.5/extras/completion/py/pymel/core/context.py/createPolyCubeCtx