<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def load_hdf5(path):
 """Load data from a HDF5 file. Args: path (str):
 A path to the HDF5 format file containing data. dense (boolean):
 An optional variable indicating if the return matrix should be dense. By default, it is false. Returns: Data matrix X and target vector y """


    with h5py.File(path, 'r') as f:
        is_sparse = f['issparse'][...]
        if is_sparse:
            shape = tuple(f['shape'][...])
            data = f['data'][...]
            indices = f['indices'][...]
            indptr = f['indptr'][...]
            X = sparse.csr_matrix((data, indices, indptr), shape=shape)
        else:
            X = f['data'][...]

        y = f['target'][...]

    return X, y