def TestSharedCache(self, other_ns):
    """Is this nameserver sharing a cache with another nameserver?

    Args:
      other_ns: A nameserver to compare it to.

    Returns:
      A tuple containing:
        - Boolean of whether or not this host has a shared cache
        - The faster NameServer object
        - The slower NameServer object
    """
    timeout = self.health_timeout * SHARED_CACHE_TIMEOUT_MULTIPLIER
    checked = []
    shared = False

    if self.is_disabled or other_ns.is_disabled:
      return False

    if not other_ns.cache_checks:
      print '%s has no cache checks (disabling - how did this happen?)' % other_ns
      other_ns.DisableWithMessage('Unable to perform cache checks.')
      return False

    for (ref_hostname, ref_response, ref_timestamp) in other_ns.cache_checks:
      response = self.TimedRequest('A', ref_hostname, timeout=timeout)[0]
      # Retry once - this *may* cause false positives however, as the TTL may be updated.
      if not response or not response.answer:
        sys.stdout.write('x')
        response = self.TimedRequest('A', ref_hostname, timeout=timeout)[0]

      if response and response.answer:
        ref_ttl = ref_response.answer[0].ttl
        ttl = response.answer[0].ttl
        delta = abs(ref_ttl - ttl)
        query_age = self.timer() - ref_timestamp
        delta_age_delta = abs(query_age - delta)

        if delta > 0 and delta_age_delta < 2:
          return other_ns
      else:
        sys.stdout.write('!')
      checked.append(ref_hostname)

    if not checked:
      self.AddFailure('Failed to test %s wildcard caches'  % len(other_ns.cache_checks))
    return shared
dataset/ETHPy150Open catap/namebench/libnamebench/health_checks.py/NameServerHealthChecks.TestSharedCache/original