def ctrl_next(W, pg, player):
    """Find controlled predecessor set.

    These are the nodes that in one step:

      - can reach W because player controls them
      - will reach W because opponent controls them,
        but has no other choice than next(W)
    """
    cnext = set()
    for node in W:
        for pred in pg.predecessors_iter(node):
            if pg.node[pred]['player'] == player:
                print('controlled by player, good')
            elif len(pg.succ[pred]) == 1:
                print('controlled by opponent, bad only 1 outgoing')
            else:
                print('not in CNext')
                continue

            cnext.add(pred)
    return cnext