@Nullable
  private static HtmlChunk getLinkToFunction(@NotNull PyFunction function, boolean preferQualifiedName) {
    final String qualifiedName = function.getQualifiedName();
    final PyClass pyClass = function.getContainingClass();
    // Preserve name of a containing class even if the whole qualified name can't be constructed
    final String shortName = pyClass == null ? function.getName() : pyClass.getName() + "." + function.getName();

    final String linkText = preferQualifiedName && qualifiedName != null ? qualifiedName : shortName;
    if (linkText == null || function.getName() == null || (pyClass != null && pyClass.getName() == null)) {
      return null;
    }

    if (qualifiedName != null) {
      return PyDocumentationLink.toFunction(linkText, function);
    }
    return HtmlChunk.raw(linkText);
  }
@Nullable
  private static HtmlChunk getLinkToFunction(@NotNull PyFunction function, boolean preferQualifiedName)