@Nullable
 public static String extractDeprecationMessage(List<PyStatement> statements) {
   for (PyStatement statement : statements) {
     if (statement instanceof PyExpressionStatement) {
       PyExpressionStatement expressionStatement = (PyExpressionStatement) statement;
       if (expressionStatement.getExpression() instanceof PyCallExpression) {
         PyCallExpression callExpression = (PyCallExpression) expressionStatement.getExpression();
         if (callExpression.isCalleeText(PyNames.WARN)) {
           PyReferenceExpression warningClass =
               callExpression.getArgument(1, PyReferenceExpression.class);
           if (warningClass != null
               && (PyNames.DEPRECATION_WARNING.equals(warningClass.getReferencedName())
                   || PyNames.PENDING_DEPRECATION_WARNING.equals(
                       warningClass.getReferencedName()))) {
             return PyPsiUtils.strValue(callExpression.getArguments()[0]);
           }
         }
       }
     }
   }
   return null;
 }
 @Override
 public void visitPyReferenceExpression(PyReferenceExpression node) {
   super.visitPyReferenceExpression(node);
   final PsiElement result = node.getReference().resolve();
   if (result != null && PsiTreeUtil.getParentOfType(result, ScopeOwner.class) == myScope) {
     if (result instanceof PyParameter && myScope instanceof PyFunction) {
       final PyFunction function = (PyFunction) myScope;
       final PyParameter[] parameters = function.getParameterList().getParameters();
       if (parameters.length > 0 && result == parameters[0]) {
         final PyFunction.Modifier modifier = function.getModifier();
         if (modifier != PyFunction.Modifier.STATICMETHOD) {
           // 'self' is not a local scope dependency
           return;
         }
       }
     }
     hasLocalScopeDependencies = true;
   }
 }