@NotNull
  static <T extends PyElement> List<T> collectStubChildren(@NotNull PyFile pyFile,
                                                           @Nullable StubElement<?> stub,
                                                           @NotNull Class<T> elementType) {
    if (stub != null) {
      final List<T> result = new ArrayList<>();
      final List<StubElement<?>> children = stub.getChildrenStubs();
      for (StubElement<?> child : children) {
        PsiElement childPsi = child.getPsi();
        if (elementType.isInstance(childPsi)) {
          result.add(elementType.cast(childPsi));
        }
      }
      return result;
    }
    else {
      return PyPsiUtilsCore.collectChildren(pyFile, elementType);
    }
  }
@NotNull
  static <T extends PyElement> List<T> collectStubChildren(@NotNull PyFile pyFile,
                                                           @Nullable StubElement<?> stub,
                                                           @NotNull Class<T> elementType)