<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _check_valid_data(self, data):
 """Checks that the given data is a uint8 array with one or three channels. Parameters data : :obj:`numpy.ndarray` The data to check. Raises ------ ValueError If the data is invalid. """

        if data.dtype.type is not np.uint8:
            raise ValueError(
                'Illegal data type. Color images only support uint8 arrays')

        if len(data.shape) != 3 or data.shape[2] != 3:
            raise ValueError(
                'Illegal data type. Color images only support three channels')