def METHOD_NAME(
    self,
    values: Sequence[int],
    condition: Callable[[int], bool] = lambda x: True,
) -> int:
    """Return some element of values satisfying the condition
    that will not lead to an exhausted branch, or raise DeadBranch
    if no such element exist".
    """
    assert not self.__finished
    node = self.__node_trail[-1]
    if node.live_child_count is None:
        node.live_child_count = len(values)
        node.n = len(values)
    assert node.live_child_count > 0 or len(values) == 0
    for i in self.__selection_order(len(self.__choices), len(values)):
        if node.live_child_count == 0:
            break
        if not node.children[i].exhausted:
            v = values[i]
            if condition(v):
                self.__choices.append(i)
                self.__node_trail.append(node.children[i])
                return v
            else:
                node.children[i] = DeadNode
                node.live_child_count -= 1
    assert node.live_child_count == 0
    raise DeadBranch()