def imgwriteincr(fn: Path, imgs, imgslice):
if isinstance(imgslice, int):<EOL><INDENT>if imgslice and not (imgslice % <NUM_LIT>):<EOL><INDENT>print(f'<STR_LIT>')<EOL><DEDENT><DEDENT>if isinstance(fn, Path):<EOL><INDENT>assert fn.suffix == '<STR_LIT>', '<STR_LIT>'<EOL>with h5py.File(fn, '<STR_LIT>') as f:<EOL><INDENT>f['<STR_LIT>'][imgslice, :, :] = imgs<EOL><DEDENT><DEDENT>elif isinstance(fn, h5py.File):<EOL><INDENT>f['<STR_LIT>'][imgslice, :, :] = imgs<EOL><DEDENT>else:<EOL><INDENT>raise TypeError(<EOL>f'<STR_LIT>')<EOL><DEDENT>
writes HDF5 huge image files in increments