code: def CreateNewZipWithSignedLibs(z_in,
                                 z_out,
                                 ignore_files=None,
                                 signer=None,
                                 skip_signing_files=None):
    
    ignore_files = ignore_files or []
    skip_signing_files = skip_signing_files or []
    extensions_to_sign = [".sys", ".exe", ".dll", ".pyd"]
    to_sign = []
    for template_file in z_in.namelist():
      if template_file not in ignore_files:
        extension = os.path.splitext(template_file)[1].lower()
        if (signer and template_file not in skip_signing_files and
            extension in extensions_to_sign):
          to_sign.append(template_file)
        else:
          CopyFileInZip(z_in, template_file, z_out)
  
    temp_files = {}
    for filename in to_sign:
      fd, path = tempfile.mkstemp()
      with os.fdopen(fd, "wb") as temp_fd:
        temp_fd.write(z_in.read(filename))
      temp_files[filename] = path
  
    try:
      signer.SignFiles(itervalues(temp_files))
    except AttributeError:
      for f in itervalues(temp_files):
        signer.SignFile(f)
  
    for filename, tempfile_path in iteritems(temp_files):
      z_out.writestr(filename, open(tempfile_path, "rb").read())
docs: Copies files from one zip to another, signing all qualifying files.