class_docstr: Resolve documentation links using searchindex.js generated by Sphinx
  
  Parameters
  ----------
  doc_url : str
      The base URL of the project website.
  searchindex : str
      Filename of searchindex, relative to doc_url.
  extra_modules_test : list of str
      List of extra module names to test.
  relative : bool
      Return relative links (only useful for links to documentation of this
      package).
docstr: Get a valid link, False if not found
docstr_tok: ["Get","a","valid","link",",","False","if","not","found"]
code: def _get_link(self, cobj):
      """Get a valid link, False if not found"""
  
      fname_idx = None
      full_name = cobj["module_short"] + "." + cobj["name"]
      if full_name in self._searchindex["objects"]:
          value = self._searchindex["objects"][full_name]
          if isinstance(value, dict):
              value = value[next(iter(value.keys()))]
          fname_idx = value[0]
      elif cobj["module_short"] in self._searchindex["objects"]:
          value = self._searchindex["objects"][cobj["module_short"]]
          if cobj["name"] in value.keys():
              fname_idx = value[cobj["name"]][0]
  
      if fname_idx is not None:
          fname = self._searchindex["filenames"][fname_idx]
          # In 1.5+ Sphinx seems to have changed from .rst.html to only
          # .html extension in converted files. But URLs could be
          # built with < 1.5 or >= 1.5 regardless of what we're currently
          # building with, so let's just check both :(
          fnames = [
              fname + ".html",
              os.path.splitext(fname)[0] + ".html",
          ]
          for i, fname in enumerate(fnames):
              try:
                  if self._is_windows:
                      fname = fname.replace("/", "\\")
                      link = os.path.join(self.doc_url, fname)
                  else:
                      link = posixpath.join(self.doc_url, fname)
  
                  if link in self._page_cache:
                      html = self._page_cache[link]
                  else:
                      html = get_data(link, self.gallery_dir)
                      self._page_cache[link] = html
              except (HTTPError, URLError, IOError):
                  if i == len(fnames) - 1:
                      raise
              else:
                  break
  
          # test if cobj appears in page
          comb_names = [cobj["module_short"] + "." + cobj["name"]]
          if self.extra_modules_test is not None:
              for mod in self.extra_modules_test:
                  comb_names.append(mod + "." + cobj["name"])
          url = False
  
          for comb_name in comb_names:
              if comb_name in html:
                  url = link + "#" + comb_name
          link = url
      else:
          link = False
  
      return link
  
imports: from __future__ import print_function
  import codecs
  import gzip
  import os
  import posixpath
  import re
  import shelve
  import sys
  from io import StringIO
  from .None import sphinx_compatibility
label_desc: Use image node_id 2 for calling the SphinxDocLinkResolver obj's underlying member method code with example usage: obj._get_link(cobj) and returns: link