code: def detect_algorithm(cls, link):
      
      if any(link.fragment.startswith('%s=' % algorithm) for algorithm in HASHLIB_ALGORITHMS):
        algorithm, value = link.fragment.split('=', 2)
        try:
          return hashlib.new(algorithm), value
        except ValueError:  # unsupported algorithm
          return None, None
      return None, None
docs: Detect the hashing algorithm from the fragment in the link, if any.