code: def _validate_jp2_box_sequence(self, boxes):
          
          JP2_IDS = ['colr', 'cdef', 'cmap', 'jp2c', 'ftyp', 'ihdr', 'jp2h',
                     'jP  ', 'pclr', 'res ', 'resc', 'resd', 'xml ', 'ulst',
                     'uinf', 'url ', 'uuid']
  
          self._validate_signature_compatibility(boxes)
          self._validate_jp2h(boxes)
          self._validate_jp2c(boxes)
          if boxes[1].brand == 'jpx ':
              self._validate_jpx_box_sequence(boxes)
          else:
              # Validate the JP2 box IDs.
              count = self._collect_box_count(boxes)
              for box_id in count.keys():
                  if box_id not in JP2_IDS:
                      msg = ("The presence of a '{0}' box requires that the "
                             "file type brand be set to 'jpx '.")
                      raise IOError(msg.format(box_id))
  
              self._validate_jp2_colr(boxes)
docs: Run through series of tests for JP2 box legality.
  
          This is non-exhaustive.