def to_dist(ranks):
    for rank in ranks:
        if (rank < remote_node):
            (yield (rank + (i * local_nodes)))
        else:
            for r in range(nodes):
                if ((r // local_nodes) != i):
                    (yield r)
def to_dist(ranks):
    for rank in ranks:
        if (rank < remote_node):
            (yield (rank + (i * local_nodes)))
        else:
            for r in range(nodes):
                if ((r // local_nodes) != i):
                    (yield r)