docs: def discoverYadis(uri):
      """Discover OpenID services for a URI. Tries Yadis and falls back
      on old-style <link rel='...'> discovery if Yadis fails.
  
      @param uri: normalized identity URL
      @type uri: str
  
      @return: (claimed_id, services)
      @rtype: (str, list(OpenIDServiceEndpoint))
  
      @raises DiscoveryFailure: when discovery fails.
      """
      # Might raise a yadis.discover.DiscoveryFailure if no document
      # came back for that URI at all.  I don't think falling back
      # to OpenID 1.0 discovery on the same URL will help, so don't
      # bother to catch it.
      response = yadisDiscover(uri)
  
      yadis_url = response.normalized_uri
      body = response.response_text
      try:
          openid_services = OpenIDServiceEndpoint.fromXRDS(yadis_url, body)
      except XRDSError:
          # Does not parse as a Yadis XRDS file
          openid_services = []
  
      if not openid_services:
          # Either not an XRDS or there are no OpenID services.
  
          if response.isXRDS():
              # if we got the Yadis content-type or followed the Yadis
              # header, re-fetch the document without following the Yadis
              # header, with no Accept header.
              return discoverNoYadis(uri)
  
          # Try to parse the response as HTML.
          # <link rel="...">
          openid_services = OpenIDServiceEndpoint.fromHTML(yadis_url, body)
  
      return (yadis_url, getOPOrUserServices(openid_services))