parameters: (backup_dir, backup_name)
return_statement: return zipfile_path
docstring: Creates a zipfile based on a tree created with `create_backup_tree()`.
docstring_summary: Creates a zipfile based on a tree created with `create_backup_tree()`.
docstring_tokens: Creates a zipfile based on a tree created with create_backup_tree () .
function: def create_backup_zip(backup_dir, backup_name):
      """Creates a zipfile based on a tree created with `create_backup_tree()`."""
      zipfile_fileno, zipfile_path = tempfile.mkstemp()
      zipfile_fd = os.fdopen(zipfile_fileno, "w")
      zf = zipfile.ZipFile(zipfile_fd, "w")
  
      for dirname, subdirs, files in os.walk(backup_dir):
          for filename in files:
              full_path = os.path.join(dirname, filename)
              rel_path = os.path.relpath(full_path, backup_dir)
              archive_path = os.path.join(backup_name, rel_path)
              zf.write(full_path, archive_path)
              logger.debug("Added to zip: {}".format(archive_path))
  
      zf.close()
      return zipfile_path
function_tokens: def create_backup_zip ( backup_dir , backup_name ) : zipfile_fileno , zipfile_path = tempfile . mkstemp ( ) zipfile_fd = os . fdopen ( zipfile_fileno , "w" ) zf = zipfile . ZipFile ( zipfile_fd , "w" ) for dirname , subdirs , files in os . walk ( backup_dir ) : for filename in files : full_path = os . path . join ( dirname , filename ) rel_path = os . path . relpath ( full_path , backup_dir ) archive_path = os . path . join ( backup_name , rel_path ) zf . write ( full_path , archive_path ) logger . debug ( "Added to zip: {}" . format ( archive_path ) ) zf . close ( ) return zipfile_path