def METHOD_NAME(hardware_source_id: str, sync: bool = True) -> typing.Any:
    """Return a generator for data.
    :param bool sync: whether to wait for current frame to finish then collect next frame
    NOTE: a new ndarray is created for each call.
    """
    hardware_source = HardwareSourceManager().get_hardware_source_for_hardware_source_id(hardware_source_id)
    assert hardware_source
    def get_last_data() -> _NDArray:
        assert hardware_source
        xdata0 = hardware_source.get_next_xdatas_to_finish()[0]
        data = xdata0.data if xdata0 else None
        assert data is not None
        return data.copy()
    yield get_last_data