<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ensure_samples_is_ndim_ndarray(samples, name='bootstrap', ndim=2):
 """ Ensures that `samples` is an `ndim` numpy array. Raises a helpful ValueError if otherwise. """

    assert isinstance(ndim, int)
    assert isinstance(name, str)
    if not isinstance(samples, np.ndarray) or not (samples.ndim == ndim):
        sample_name = name + "_samples"
        msg = "`{}` MUST be a {}D ndarray.".format(sample_name, ndim)
        raise ValueError(msg)
    return None