def METHOD_NAME(hdf5_file, x, group=None, dataset=None, **kwds):
    import h5py
    x = astensor(x)
    if isinstance(hdf5_file, h5py.Dataset):
        filename = hdf5_file.file.filename
        group = hdf5_file.parent.name
        dataset = hdf5_file.name.rsplit("/", 1)[1]
    elif isinstance(hdf5_file, h5py.File):
        filename = hdf5_file.filename
        if dataset is None:
            raise ValueError("`dataset` should be provided")
    elif isinstance(hdf5_file, str):
        filename = hdf5_file
        if dataset is None:
            raise ValueError("`dataset` should be provided")
    else:
        raise TypeError(
            "`hdf5_file` passed has wrong type, "
            "expect str, h5py.File or h5py.Dataset, "
            f"got {type(hdf5_file)}"
        )
    op = TensorHDF5DataStore(
        filename=filename, group=group, dataset=dataset, dataset_kwds=kwds
    )
    return op(x)