code: def _validate_compression_params(self, img_array, cparams, colorspace):
          
          self._validate_j2k_colorspace(cparams, colorspace)
          self._validate_codeblock_size(cparams)
          self._validate_precinct_size(cparams)
          self._validate_image_rank(img_array)
          self._validate_image_datatype(img_array)
docs: Check that the compression parameters are valid.
  
          Parameters
          ----------
          img_array : ndarray
              Image data to be written to file.
          cparams : CompressionParametersType(ctypes.Structure)
              Corresponds to cparameters_t type in openjp2 headers.