public void optimizeImports() {
    final List<PsiElement> elementsToDelete = collectUnusedImportElements();
    for (PsiElement element : elementsToDelete) {
      PyPsiUtils.assertValid(element);
      element.delete();
    }
  }
public void optimizeImports()