code: def new_zip(self, filename, deleted_files=None, new_files={}):
          
          zout = zipfile.ZipFile(filename, 'w')
  
          for item in self.zip.infolist():
              # Block one: deleted_files, or deleted_files and new_files
              if deleted_files is not None:
                  if re.match(deleted_files, item.filename) is None:
                      # if the regex of deleted_files doesn't match the filename
                      if new_files is not False:
                          if item.filename in new_files:
                              # and if the filename is in new_files
                              zout.writestr(item, new_files[item.filename])
                              continue
                      # Otherwise, write the original file.
                      buffer = self.zip.read(item.filename)
                      zout.writestr(item, buffer)
              # Block two: deleted_files is None, new_files is not empty
              elif new_files is not False:
                  if item.filename in new_files:
                      zout.writestr(item, new_files[item.filename])
                  else:
                      buffer = self.zip.read(item.filename)
                      zout.writestr(item, buffer)
              # Block three: deleted_files is None, new_files is empty.
              # Just write out the default zip
              else:
                  buffer = self.zip.read(item.filename)
                  zout.writestr(item, buffer)
          zout.close()
docs: Create a new zip file
  
              :param filename: the output filename of the zip
              :param deleted_files: a regex pattern to remove specific file
              :param new_files: a dictionnary of new files
  
              :type filename: string
              :type deleted_files: None or a string
              :type new_files: a dictionnary (key:filename, value:content of the file)