code: def grab_keyfile(cert_url):
      
      key_cache = caches[getattr(settings, 'BOUNCY_KEY_CACHE', 'default')]
  
      pemfile = key_cache.get(cert_url)
      if not pemfile:
          response = urlopen(cert_url)
          pemfile = response.read()
          # Extract the first certificate in the file and confirm it's a valid
          # PEM certificate
          certificates = pem.parse(smart_bytes(pemfile))
  
          # A proper certificate file will contain 1 certificate
          if len(certificates) != 1:
              logger.error('Invalid Certificate File: URL %s', cert_url)
              raise ValueError('Invalid Certificate File')
  
          key_cache.set(cert_url, pemfile)
      return pemfile
docs: Function to acqure the keyfile
  
      SNS keys expire and Amazon does not promise they will use the same key
      for all SNS requests. So we need to keep a copy of the cert in our
      cache