code: def _cached_by_domain(api_name):
      
  
      def wrapped(func):
          def decorated(self, domains):
              if not self._cache:
                  return func(self, domains)
  
              all_responses = self._cache.bulk_lookup(api_name, domains)
              domains = list(set(domains) - set(all_responses))
  
              if domains:
                  response = func(self, domains)
  
                  if not response:
                      raise ResponseError("No response for uncached domains")
  
                  for domain in response:
                      self._cache.cache_value(api_name, domain, response[domain])
                      all_responses[domain] = response[domain]
  
              return all_responses
          return decorated
      return wrapped
docs: A caching wrapper for functions that take a list of domains as
      parameters.
  
      Raises:
          ResponseError - if the response received from the endpoint is
          not valid.