PsiElement (@Nullable PsiElement element) { if (element == null) return null; final TypeEvalContext context = TypeEvalContext.codeInsightFallback(element.getProject()); final PyCallExpression callExpression = PsiTreeUtil.getParentOfType(element, PyCallExpression.class); if (callExpression != null) { final PyResolveContext resolveContext = PyResolveContext.implicitContext(context); final PyCallable resolved = ContainerUtil.getFirstItem(callExpression.multiResolveCalleeFunction(resolveContext)); return resolved instanceof PyFunction && PyiUtil.isOverload(resolved, context) ? PyiUtil.getImplementation((PyFunction)resolved, context) : resolved; } final PyFunction parent = PsiTreeUtil.getParentOfType(element, PyFunction.class); if (parent != null && PyiUtil.isOverload(parent, context)) { return null; } return parent; }