public static void addLocalFromImportStatement(@NotNull PsiElement element,
                                                 @NotNull String qualifier,
                                                 @NotNull String name,
                                                 @Nullable String asName) {
    final PyElementGenerator generator = PyElementGenerator.getInstance(element.getProject());
    final LanguageLevel languageLevel = LanguageLevel.forElement(element);

    final PsiElement anchor = getLocalInsertPosition(element);
    final PsiElement parentElement = sure(anchor).getParent();
    if (parentElement != null) {
      parentElement.addBefore(generator.createFromImportStatement(languageLevel, qualifier, name, asName), anchor);
    }

  }
public static void addLocalFromImportStatement(@NotNull PsiElement element,
                                                 @NotNull String qualifier,
                                                 @NotNull String name,
                                                 @Nullable String asName)