List<PyFunction> (@NotNull final PyClass destination, final boolean skipIfExist, final PyFunction @NotNull ... methods) { final PyStatementList destStatementList = destination.getStatementList(); final List<PyFunction> result = new ArrayList<>(methods.length); for (final PyFunction method : methods) { final PyFunction existingMethod = destination.findMethodByName(method.getName(), false, null); if ((existingMethod != null) && skipIfExist) { result.add(existingMethod); continue; //We skip adding if class already has this method. } result.add(insertMethodInProperPlace(destStatementList, method)); } PyPsiUtils.removeRedundantPass(destStatementList); return result; }