protected static @Nullable PyFunction getSuperMethod(@Nullable PyFunction function) {
    if (function == null) {
      return null;
    }
    final PyClass containingClass = function.getContainingClass();
    if (containingClass == null) {
      return function;
    }
    if (PyUtil.isInitOrNewMethod(function)) {
      return function;
    }
    final PyFunction deepestSuperMethod = PySuperMethodsSearch.findDeepestSuperMethod(function);
    if (!deepestSuperMethod.equals(function)) {
      final PyClass baseClass = deepestSuperMethod.getContainingClass();
      final PyBuiltinCache cache = PyBuiltinCache.getInstance(baseClass);
      final String baseClassName = baseClass == null ? "" : baseClass.getName();
      if (cache.isBuiltin(baseClass)) {
        return function;
      }
      final String message = PyBundle.message("refactoring.change.signature.find.usages.of.base.class",
                                              function.getName(),
                                              containingClass.getName(),
                                              baseClassName);
      final int choice = Messages.showYesNoCancelDialog(function.getProject(), message, 
                                                        RefactoringBundle.message("changeSignature.refactoring.name"), Messages.getQuestionIcon());
      return switch (choice) {
        case Messages.YES -> deepestSuperMethod;
        case Messages.NO -> function;
        default -> null;
      };
    }
    return function;
  }
protected static @Nullable PyFunction getSuperMethod(@Nullable PyFunction function)