code: def prepare_hdf5_file(hdf5_file, n_train, n_valid, n_test):
      
      n_total = n_train + n_valid + n_test
      splits = create_splits(n_train, n_valid, n_test)
      hdf5_file.attrs['split'] = H5PYDataset.create_split_array(splits)
      vlen_dtype = h5py.special_dtype(vlen=numpy.dtype('uint8'))
      hdf5_file.create_dataset('encoded_images', shape=(n_total,),
                               dtype=vlen_dtype)
      hdf5_file.create_dataset('targets', shape=(n_total, 1), dtype=numpy.int16)
      hdf5_file.create_dataset('filenames', shape=(n_total, 1), dtype='S32')
docs: Create datasets within a given HDF5 file.
  
      Parameters
      ----------
      hdf5_file : :class:`h5py.File` instance
          HDF5 file handle to which to write.
      n_train : int
          The number of training set examples.
      n_valid : int
          The number of validation set examples.
      n_test : int
          The number of test set examples.