def _validate(self, writing=False):
if ((len(self.bits_per_component) != len(self.signed)) or<EOL>(len(self.signed) != self.palette.shape[<NUM_LIT:1>])):<EOL><INDENT>msg = ("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>self._dispatch_validation_error(msg, writing=writing)<EOL><DEDENT>bps = self.bits_per_component<EOL>if writing and not all(b == bps[<NUM_LIT:0>] for b in bps):<EOL><INDENT>msg = "<STR_LIT>"<EOL>self._dispatch_validation_error(msg, writing=writing)<EOL><DEDENT>
Verify that the box obeys the specifications.