def setupimgh5(f: Union[Path, h5py.File],<EOL>Nframetotal: int, Nrow: int, Ncol: int, dtype=np.uint16,<EOL>writemode='<STR_LIT>', key='<STR_LIT>', cmdlog: str=None):
if isinstance(f, (str, Path)):  <EOL><INDENT>f = Path(f).expanduser()<EOL>if f.is_dir():<EOL><INDENT>raise IOError(<EOL>'<STR_LIT>')<EOL><DEDENT>print('<STR_LIT>', f)<EOL>with h5py.File(f, writemode) as F:<EOL><INDENT>setupimgh5(F, Nframetotal, Nrow, Ncol, dtype, writemode, key)<EOL><DEDENT><DEDENT>elif isinstance(f, h5py.File):<EOL><INDENT>h = f.create_dataset(key,<EOL>shape=(Nframetotal, Nrow, Ncol),<EOL>dtype=dtype,<EOL>chunks=(<NUM_LIT:1>, Nrow, Ncol),  <EOL>compression='<STR_LIT>',<EOL>compression_opts=<NUM_LIT:1>,<EOL>shuffle=True,<EOL>fletcher32=True,<EOL>track_times=True)<EOL>h.attrs["<STR_LIT>"] = np.string_("<STR_LIT>")<EOL>h.attrs["<STR_LIT>"] = np.string_("<STR_LIT>")<EOL>h.attrs["<STR_LIT>"] = np.string_("<STR_LIT>")<EOL>h.attrs["<STR_LIT>"] = np.string_("<STR_LIT>")<EOL>h.attrs['<STR_LIT>'] = np.uint8(<NUM_LIT:0>)<EOL>if cmdlog and isinstance(cmdlog, str):<EOL><INDENT>f['<STR_LIT>'] = cmdlog<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise TypeError(<EOL>f'<STR_LIT>')<EOL><DEDENT>
f: HDF5 handle (or filename)

h: HDF5 dataset handle