code: def _check_valid_data(self, data):
          
          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')
docs: 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.