private static @Nullable PsiElement getLowermostTopLevelStatement(@NotNull List<PsiElement> elements) {
    return StreamEx.of(elements)
      .map(it -> PyPsiUtils.getParentRightBefore(it, it.getContainingFile()))
      .select(PyStatement.class)
      .max(PsiUtilCore::compareElementsByPosition)
      .orElse(null);
  }
private static @Nullable PsiElement getLowermostTopLevelStatement(@NotNull List<PsiElement> elements)