Ref<PyExpression> (@NotNull PyCallExpression expression, @NotNull String key, boolean goDeep) { final PyExpression callee = expression.getCallee(); boolean allKeysForSure = true; final LanguageLevel languageLevel = LanguageLevel.forElement(expression); if (callee != null) { final String name = callee.getName(); if ("dict".equals(name)) { final PyArgumentList argumentList = expression.getArgumentList(); for (PyExpression arg : expression.getArguments()) { if (languageLevel.isAtLeast(LanguageLevel.PYTHON35) && goDeep && arg instanceof PyStarExpression) { PyExpression expr = ((PyStarExpression)arg).getExpression(); if (expr instanceof PyDictLiteralExpression) { Ref<PyExpression> element = getElementFromDictLiteral((PyDictLiteralExpression)expr, key); if (element != null) return element; } else if (expr instanceof PyCallExpression) { Ref<PyExpression> element = resolveDictCall((PyCallExpression)expr, key, false); if (element != null) return element; } else { allKeysForSure = false; } } if (!(arg instanceof PyKeywordArgument)) { allKeysForSure = false; } } if (argumentList != null) { PyKeywordArgument argument = argumentList.getKeywordArgument(key); if (argument != null) { return Ref.create(argument); } else { return allKeysForSure ? Ref.create() : null; } } } } return Ref.create(expression); }