code: def store_and_use_artifact(self, cache_key, src, results_dir=None):
      
      with self._tmpfile(cache_key, 'read') as tmp:
        for chunk in src:
          tmp.write(chunk)
        tmp.close()
        tarball = self._store_tarball(cache_key, tmp.name)
        artifact = self._artifact(tarball)
  
        # NOTE(mateo): The two clean=True args passed in this method are likely safe, since the cache will by
        # definition be dealing with unique results_dir, as opposed to the stable vt.results_dir (aka 'current').
        # But if by chance it's passed the stable results_dir, safe_makedir(clean=True) will silently convert it
        # from a symlink to a real dir and cause mysterious 'Operation not permitted' errors until the workdir is cleaned.
        if results_dir is not None:
          safe_mkdir(results_dir, clean=True)
  
        try:
          artifact.extract()
        except Exception:
          # Do our best to clean up after a failed artifact extraction. If a results_dir has been
          # specified, it is "expected" to represent the output destination of the extracted
          # artifact, and so removing it should clear any partially extracted state.
          if results_dir is not None:
            safe_mkdir(results_dir, clean=True)
          safe_delete(tarball)
          raise
  
        return True
docs: Store and then extract the artifact from the given `src` iterator for the given cache_key.
  
      :param cache_key: Cache key for the artifact.
      :param src: Iterator over binary data to store for the artifact.
      :param str results_dir: The path to the expected destination of the artifact extraction: will
        be cleared both before extraction, and after a failure to extract.