code: def python_zip(file_list, gallery_path, extension=".py"):
      """Stores all files in file_list into an zip file
  
      Parameters
      ----------
      file_list : list of strings
          Holds all the file names to be included in zip file
      gallery_path : string
          path to where the zipfile is stored
      extension : str
          '.py' or '.ipynb' In order to deal with downloads of python
          sources and jupyter notebooks the file extension from files in
          file_list will be removed and replace with the value of this
          variable while generating the zip file
      Returns
      -------
      zipname : string
          zip file name, written as `target_dir_{python,jupyter}.zip`
          depending on the extension
      """
      zipname = os.path.basename(gallery_path)
      zipname += "_python" if extension == ".py" else "_jupyter"
      zipname = os.path.join(gallery_path, zipname + ".zip")
  
      zipf = zipfile.ZipFile(zipname, mode="w")
      for fname in file_list:
          file_src = os.path.splitext(fname)[0] + extension
          zipf.write(file_src, os.path.relpath(file_src, gallery_path))
      zipf.close()
  
      return zipname
  
imports: from __future__ import absolute_import, division, print_function
  import os
  import zipfile
label_desc: Use image node_id 1 for calling a global function with example usage: python_zip(file_list, gallery_path, extension) and returns: zipname