@staticmethod
def _ensure3(val, name):
    """
        Make sure that the value is a scalar or a list with 3 values.
        If the number of items is less than 3, raise an error.

        Parameters
        ----------
        val : `str` or `float` or `int`
            Scalar value or a list with 3 items.
        name : `str`
            Name associated with the value (for error traceability).

        Returns
        -------
        out : `list`
            List with 3 items.
        """
    ret = val if type(val) == list else [val, val, val]
    if not len(ret) == 3:
        raise ValueError('%s list should have 3 items' % name)
    return ret
