Ref<QualifiedName> (@NotNull PyTargetExpression psi) { final PyTargetExpressionStub stub = psi.getStub(); if (stub != null) { if (stub.getInitializerType() == PyTargetExpressionStub.InitializerType.ReferenceExpression) { return Ref.create(stub.getInitializer()); } return null; } final PyExpression value = psi.findAssignedValue(); return value instanceof PyReferenceExpression ? Ref.create(((PyReferenceExpression)value).asQualifiedName()) : null; }