private void checkReturnValueAllowed(@NotNull PyCallable callable,
                                         @NotNull PsiElement beingChecked,
                                         boolean allowed,
                                         @NotNull @InspectionMessage String message) {
      if (callable instanceof PyFunction function) {

        if (PyKnownDecoratorUtil.hasAbstractDecorator(function, myTypeEvalContext)) {
          return;
        }

        PyClass containingClass = function.getContainingClass();
        if (containingClass != null && isProtocol(containingClass, myTypeEvalContext)) {
          return;
        }

        if (allowed && !someFlowHasExitPoint(function, Visitor::isAllowedExitPoint) ||
            !allowed && someFlowHasExitPoint(function, Visitor::isDisallowedExitPoint)) {
          registerProblem(beingChecked, message);
        }
      }
      else {
        final PyType type = myTypeEvalContext.getReturnType(callable);
        final boolean hasReturns = !(type instanceof PyNoneType);

        if (allowed ^ hasReturns) {
          registerProblem(beingChecked, message);
        }
      }
    }
private void checkReturnValueAllowed(@NotNull PyCallable callable,
                                         @NotNull PsiElement beingChecked,
                                         boolean allowed,
                                         @NotNull @InspectionMessage String message)