private static boolean someFlowHasExitPoint(@NotNull PyFunction function, @NotNull Predicate<PsiElement> exitPointPredicate) {
      final Ref<Boolean> result = new Ref<>(false);

      ControlFlowUtil.process(ControlFlowCache.getControlFlow(function).getInstructions(),
                              0,
                              instruction -> {
                                result.set(exitPointPredicate.test(instruction.getElement()));
                                return !result.get();
                              }
      );

      return result.get();
    }
private static boolean someFlowHasExitPoint(@NotNull PyFunction function, @NotNull Predicate<PsiElement> exitPointPredicate)