def METHOD_NAME(cls, val):
    """Make sure the number of dimensions is correct."""
    if cls.ndim and val.ndim != cls.ndim:
        raise ValidationError(f"Expected {cls.ndim} dimensions for ArrayLike, got {val.ndim}.")
    return val