def check_units(value, dimension: str):
    """ Check if units are of a certain dimension
    
    Parameters
    ---------- 
    value: `pint.quantity._Quantity`
        The pint :class:`pint.quantity._Quantity` to check
    dimemension: `str`
        Desired dimensionality of value

    Returns
    -------
    result: `bool`
        If the units are of the desired dimension, returns True.

    Raises
    ------
    ValueError
        Raised if the unit dimensions are incorrrect or the
        the value is not a pint unit quantity.

    Examples
    --------
    >>> check_units(100 * units.millilters, '[length]^3')
    True

    Notes
    -----
    See the pint_ documentation for more examples on dimensionality.

    .. pint_: https://pint.readthedocs.io/en/latest/wrapping.html#checking-dimensionality
    """
    try:
        if value.check(dimension):
            return True
        else:
            raise ValueError(
                f'{value} must contain pint units of dimension {dimension}.')
    except AttributeError:
        raise ValueError(
            f'{value} does contain pint units.(must be of dimension {dimension}).'
            )
