@Override
  public void doApply(@NotNull Editor editor, @NotNull PySmartEnterProcessor processor, @NotNull PyConditionalStatementPart statementPart)
    throws IncorrectOperationException {
    final PyExpression condition = statementPart.getCondition();
    final Document document = editor.getDocument();
    final PsiElement colon = PyPsiUtils.getFirstChildOfType(statementPart, PyTokenTypes.COLON);
    if (colon == null) {
      if (condition != null) {
        final PsiElement firstNonComment = PyPsiUtils.getNextNonCommentSibling(condition.getNextSibling(), false);
        if (firstNonComment != null && !":".equals(firstNonComment.getNode().getText())) {
          document.insertString(firstNonComment.getTextRange().getEndOffset(), ":");
        }
      }
      else {
        final TokenSet keywords = TokenSet.create(PyTokenTypes.IF_KEYWORD, PyTokenTypes.ELIF_KEYWORD, PyTokenTypes.WHILE_KEYWORD);
        final PsiElement keywordToken = PyPsiUtils.getChildByFilter(statementPart,
                                                                    keywords, 0);
        final int offset = sure(keywordToken).getTextRange().getEndOffset();
        document.insertString(offset, " :");
        processor.registerUnresolvedError(offset + 1);
      }
    }
    else if (condition == null) {
      processor.registerUnresolvedError(colon.getTextRange().getStartOffset());
    }
  }
@Override
  public void doApply(@NotNull Editor editor, @NotNull PySmartEnterProcessor processor, @NotNull PyConditionalStatementPart statementPart)