def _strip_extensions(s, extensions):
   """Remove all the specified extensions from the supplied string.
   
   Args:
     s: string, generally a filename.
     extensions: list of strings, extensions to remove. Each extension
       is removed in order. For example, To remove .tar.gz, you can
       either specify [".tar.gz"] or [".gz", ".tar"]. The former will only
       remove ".tar.gz", while the latter will remove ".gz", ".tar",
       ".tar.gz", but not ".gz.tar".

   Returns:
     The string with all the supplied extensions removed.
   """
   for e in extensions:
     if s.endswith(e):
       s = s[:-len(e)]
   return s