@Override
  public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) {
    final Editor editor = context.getEditor();
    final Document document = editor.getDocument();
    if (context.getCompletionChar() == '(') {
      context.setAddCompletionChar(false);
      final int offset = context.getTailOffset();
      document.insertString(offset, "()");

      PyClass pyClass = PyUtil.as(item.getPsiElement(), PyClass.class);
      PyFunction init = pyClass != null ? pyClass.findInitOrNew(true, null) : null;
      if (init != null && PyFunctionInsertHandler.hasParams(context, init)) {
        editor.getCaretModel().moveToOffset(offset+1);
        AutoPopupController.getInstance(context.getProject()).autoPopupParameterInfo(context.getEditor(), init);
      }
      else {
        editor.getCaretModel().moveToOffset(offset+2);
      }
    }
  }
@Override
  public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item)