@NotNull
  private PsiElement resolveToDocStringOwner() {
    // here the ^Q target is already resolved; the resolved element may point to intermediate assignments
    if (myElement instanceof PyTargetExpression && ((PyTargetExpression)myElement).getDocStringValue() == null) {
      final PyExpression assignedValue = ((PyTargetExpression)myElement).findAssignedValue();
      if (assignedValue instanceof PyReferenceExpression) {
        final PsiElement resolved = resolveWithoutImplicits((PyReferenceExpression)assignedValue);
        if (resolved instanceof PyDocStringOwner) {
          String name = ((PyTargetExpression)myElement).getName();
          if (name != null) {
            mySectionsMap.get(PyPsiBundle.message("QDOC.assigned.to")).append(HtmlChunk.text(name).code());
          }
          return resolved;
        }
      }
    }
    // Reference expression can be passed as the target element in Python console
    if (myElement instanceof PyReferenceExpression) {
      final PsiElement resolved = resolveWithoutImplicits((PyReferenceExpression)myElement);
      if (resolved != null) {
        return resolved;
      }
    }
    return myElement;
  }
@NotNull
  private PsiElement resolveToDocStringOwner()