public static boolean isPackage(@NotNull PsiDirectory directory, boolean checkSetupToolsPackages, @Nullable PsiElement anchor) {
    if (isExplicitPackage(directory)) return true;
    @NotNull PsiElement element = anchor != null ? anchor : directory;
    final LanguageLevel level = LanguageLevel.forElement(element);
    if (!level.isPython2()) {
      return true;
    }
    return checkSetupToolsPackages && isSetuptoolsNamespacePackage(directory);
  }
public static boolean isPackage(@NotNull PsiDirectory directory, boolean checkSetupToolsPackages, @Nullable PsiElement anchor)