def find_dataset(h5o, path=None):
<EOL>if isinstance(h5o, h5py.Dataset):<EOL><INDENT>return h5o<EOL><DEDENT>elif path is None and len(h5o) == <NUM_LIT:1>:<EOL><INDENT>path = list(h5o.keys())[<NUM_LIT:0>]<EOL><DEDENT>elif path is None:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>return h5o[path]<EOL>
Find and return the relevant dataset inside the given H5 object

    If ``path=None`` is given, and ``h5o`` contains a single dataset, that
    will be returned

    Parameters
    ----------
    h5o : `h5py.File`, `h5py.Group`
        the HDF5 object in which to search

    path : `str`, optional
        the path (relative to ``h5o``) of the desired data set

    Returns
    -------
    dset : `h5py.Dataset`
        the recovered dataset object

    Raises
    ------
    ValueError
        if ``path=None`` and the HDF5 object contains multiple datasets
    KeyError
        if ``path`` is given but is not found within the HDF5 object