code: def python_zip(file_list, gallery_path, extension='.py'):
      
      zipname = os.path.basename(os.path.normpath(gallery_path))
      zipname += '_python' if extension == '.py' else '_jupyter'
      zipname = os.path.join(gallery_path, zipname + '.zip')
      zipname_new = zipname + '.new'
      with zipfile.ZipFile(zipname_new, mode='w') as zipf:
          for fname in file_list:
              file_src = os.path.splitext(fname)[0] + extension
              zipf.write(file_src, os.path.relpath(file_src, gallery_path))
      _replace_md5(zipname_new)
      return zipname
docs: Stores all files in file_list into an zip file
  
      Parameters
      ----------
      file_list : list
          Holds all the file names to be included in zip file
      gallery_path : str
          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 : str
          zip file name, written as `target_dir_{python,jupyter}.zip`
          depending on the extension