private static boolean isRaiseNotImplementedError(@NotNull PyAstStatement statement) {
    final PyAstExpression raisedExpression = Optional
      .ofNullable(ObjectUtils.tryCast(statement, PyAstRaiseStatement.class))
      .map(PyAstRaiseStatement::getExpressions)
      .filter(expressions -> expressions.length == 1)
      .map(expressions -> expressions[0])
      .orElse(null);

    if (raisedExpression instanceof PyAstCallExpression) {
      final PyAstExpression callee = ((PyAstCallExpression)raisedExpression).getCallee();
      if (callee != null && callee.getText().equals(PyNames.NOT_IMPLEMENTED_ERROR)) {
        return true;
      }
    }
    else if (raisedExpression != null && raisedExpression.getText().equals(PyNames.NOT_IMPLEMENTED_ERROR)) {
      return true;
    }

    return false;
  }
private static boolean isRaiseNotImplementedError(@NotNull PyAstStatement statement)