def url_for_comparison(url, api = nil, parsed: false)
      if url.is_a?(MatchData) && parsed
        url
      elsif parsed && url.respond_to?(:parsed_url)
        url.parsed_url
      elsif !parsed && url.respond_to?(url)
        url.url
      else
        result = api.nil? ? url.to_s : api.canonical_url(url.to_s)
        parsed ? parse_url(result) : result
      end
    end
def url_for_comparison(url, api = nil, parsed: false)
      if url.is_a?(MatchData) && parsed
        url
      elsif parsed && url.respond_to?(:parsed_url)
        url.parsed_url
      elsif !parsed && url.respond_to?(url)
        url.url
      else
        result = api.nil? ? url.to_s : api.canonical_url(url.to_s)
        parsed ? parse_url(result) : result
      end
    end
Returns a parsed or unparsed URL for comparison
 @param url [Aspire::Caching::CacheEntry, String] the URL
 @param api [Aspire::API::LinkedData] the API for generating canonical URLs
 @param parsed [Boolean] if true, return a parsed URL, otherwise return
   an unparsed URL string
 @return [Aspire::Caching::CacheEntry, String] the URL for comparison