def METHOD_NAME(topology, xs):
    for x in xs:
        x.cores_left = list(x.core_ids)
    cores = []
    while max([len(x.cores_left) for x in xs]):
        x = xs[0]
        xs = xs[1:]
        xs.append(x)
        if x.cores_left:
            c = x.cores_left[0]
            del(x.cores_left[0])
            cores.append(c)
    return cores