code: def put_content(self, url, content):
          
          cache_path = self._url_to_path(url)
  
          # Ensure that cache directories exist
          try:
              dir = os.path.dirname(cache_path)
              os.makedirs(dir)
          except OSError as e:
              if e.errno != errno.EEXIST:
                  raise Error('Failed to create cache directories for ' % cache_path)
  
          try:
              with open(cache_path, 'wb') as f:
                  f.write(content)
          except IOError:
              raise Error('Failed to cache content as %s for %s' % (cache_path, url))
docs: Stores the content of a resource into the disk cache.
  
          Args:
              url: The url of the resource
              content: The content of the resource
  
          Raises:
              CacheError: If the content cannot be put in cache