'Open streaming ZIP file with mode read "r", write "w" or append "a".
Args:
fd_or_path: Either the path to the file, or a file-like object.
If it is a path, the file will be opened and closed by
ZipFile.
mode: The mode can be either read "r", write "w" or append "a".
compression: ZIP_STORED (no compression) or ZIP_DEFLATED (requires zlib).'

def __init__(self, fd_or_path, mode='wb', compression=zipfile.ZIP_STORED):

    if hasattr(fd_or_path, 'write'):
        self._fd = fd_or_path
    else:
        self._fd = open(fd_or_path, mode)
    self._generator = StreamingZipGenerator(compression=compression)
