code: def get_docs_url(self, role, name):
          
  
          if role == 'cite':
              # If the cross-reference is a citation, make sure that
              # the cite key is in the sphinx environment bibtex cache.
              # If it is, construct the url from the cite key, otherwise
              # raise an exception
              if name not in self.env.bibtex_cache.get_all_cited_keys():
                  raise KeyError('cite key %s not found' % name, 'cite', 0)
              url = self.baseurl + 'zreferences.html#' + name
          elif role == 'ref':
              try:
                  reftpl = self.env.domaindata['std']['labels'][name]
              except Exception:
                  raise KeyError('ref label %s not found' % name, 'ref', 0)
              url = self.baseurl + reftpl[0] + '.html#' + reftpl[1]
          else:
              # If the  cross-reference is not a citation, try to look it
              # up in each of the IntersphinxInventory objects in our list
              url = None
              for ii in self.invlst:
                  try:
                      url = ii.get_docs_url(role, name)
                  except KeyError as ex:
                      # Re-raise the exception if multiple matches found,
                      # otherwise ignore it
                      if ex.args[1] == 'role' or ex.args[2] > 1:
                          raise ex
                  else:
                      # If an exception was not raised, the lookup must
                      # have succeeded: break from the loop to terminate
                      # further searching
                      break
  
              if url is None:
                  raise KeyError('name %s not found' % name, 'name', 0)
  
          return url
docs: Get the online docs url for sphinx cross-reference :role:`name`.