def _get_cached_certs(cert_uri, cache):
certs = cache.get(cert_uri, namespace=_CERT_NAMESPACE)<EOL>if certs is None:<EOL><INDENT>_logger.debug('<STR_LIT>', cert_uri)<EOL>try:<EOL><INDENT>result = urlfetch.fetch(cert_uri)<EOL><DEDENT>except AssertionError:<EOL><INDENT>return None<EOL><DEDENT>if result.status_code == <NUM_LIT:200>:<EOL><INDENT>certs = json.loads(result.content)<EOL>expiration_time_seconds = _get_cert_expiration_time(result.headers)<EOL>if expiration_time_seconds:<EOL><INDENT>cache.set(cert_uri, certs, time=expiration_time_seconds,<EOL>namespace=_CERT_NAMESPACE)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>_logger.error(<EOL>'<STR_LIT>', result.status_code)<EOL><DEDENT><DEDENT>return certs<EOL>
Get certs from cache if present; otherwise, gets from URI and caches them.

    Args:
      cert_uri: URI from which to retrieve certs if cache is stale or empty.
      cache: Cache of pre-fetched certs.

    Returns:
      The retrieved certs.