code: def substitute_ref_with_url(self, txt):
          
  
          # Find sphinx cross-references
          mi = re.finditer(r':([^:]+):`([^`]+)`', txt)
          if mi:
              # Iterate over match objects in iterator returned by re.finditer
              for mo in mi:
                  # Initialize link label and url for substitution
                  lbl = None
                  url = None
                  # Get components of current match: full matching text, the
                  # role label in the reference, and the name of the
                  # referenced type
                  mtxt = mo.group(0)
                  role = mo.group(1)
                  name = mo.group(2)
  
                  # If role is 'ref', the name component is in the form
                  # label <name>
                  if role == 'ref':
                      ma = re.match(r'\s*([^\s<]+)\s*<([^>]+)+>', name)
                      if ma:
                          name = ma.group(2)
                          lbl = ma.group(1)
  
                  # Try to look up the current cross-reference. Issue a
                  # warning if the lookup fails, and do the substitution
                  # if it succeeds.
                  try:
                      url = self.get_docs_url(role, name)
                      if role != 'ref':
                          lbl = self.get_docs_label(role, name)
                  except KeyError as ex:
                      if len(ex.args) == 1 or ex.args[1] != 'role':
                          print('Warning: %s' % ex.args[0])
                  else:
                      # If the cross-reference lookup was successful, replace
                      # it with an appropriate link to the online docs
                      rtxt = '[%s](%s)' % (lbl, url)
                      txt = re.sub(mtxt, rtxt, txt, flags=re.M)
  
          return txt
docs: In the string `txt`, replace sphinx references with
          corresponding links to online docs.