@Override
    public void visitPyBinaryExpression(final @NotNull PyBinaryExpression node) {
      myIsLeft = false;
      myIsRight = false;
      myOperator = null;
      getInnerRight = false;

      final PyBinaryExpression leftExpression = as(node.getLeftExpression(), PyBinaryExpression.class);
      final PyBinaryExpression rightExpression = as(node.getRightExpression(), PyBinaryExpression.class);

      if (leftExpression != null && rightExpression != null && node.getOperator() == PyTokenTypes.AND_KEYWORD) {
        boolean applicable = false;
        if (leftExpression.getOperator() == PyTokenTypes.AND_KEYWORD) {
          final PyBinaryExpression leftLeft = as(leftExpression.getLeftExpression(), PyBinaryExpression.class);
          final PyBinaryExpression leftRight = as(leftExpression.getRightExpression(), PyBinaryExpression.class);
          if (leftLeft != null && (isRightSimplified(leftLeft, rightExpression) || isLeftSimplified(leftLeft, rightExpression))) {
            applicable = true;
            getInnerRight = false;
          }
          else if (leftRight != null && (isRightSimplified(leftRight, rightExpression) || isLeftSimplified(leftRight, rightExpression))) {
            applicable = true;
            getInnerRight = true;
          }
        }
        else if (isRightSimplified(leftExpression, rightExpression) || isLeftSimplified(leftExpression, rightExpression)) {
          applicable = true;
        }

        if (applicable) {
          if (isConstantInTheMiddle) {
            if (!ignoreConstantInTheMiddle) {
              registerProblem(node, PyPsiBundle.message("INSP.simplify.chained.comparison"),
                              new ChainedComparisonsQuickFix(myIsLeft, myIsRight, getInnerRight),
                              LocalQuickFix.from(new UpdateInspectionOptionFix(
                                PyChainedComparisonsInspection.this, "ignoreConstantInTheMiddle",
                                PyPsiBundle.message("INSP.chained.comparisons.ignore.statements.with.constant.in.the.middle"),
                                true)));
            }
          }
          else {
            registerProblem(node, PyPsiBundle.message("INSP.simplify.chained.comparison"), new ChainedComparisonsQuickFix(myIsLeft, myIsRight, getInnerRight));
          }
        }
      }
    }
@Override
    public void visitPyBinaryExpression(final @NotNull PyBinaryExpression node)