Visibility (PyElement element) { if (!(element instanceof PyTargetExpression) && PsiTreeUtil.getParentOfType(element, PyFunction.class) != null) { return Visibility.INVISIBLE; } else { return getVisibilityByName(element.getName()); } }