code: def _check_jp2h_child_boxes(self, boxes, parent_box_name):
          
          JP2H_CHILDREN = set(['bpcc', 'cdef', 'cmap', 'ihdr', 'pclr'])
  
          box_ids = set([box.box_id for box in boxes])
          intersection = box_ids.intersection(JP2H_CHILDREN)
          if len(intersection) > 0 and parent_box_name not in ['jp2h', 'jpch']:
              msg = "A {0} box can only be nested in a JP2 header box."
              raise IOError(msg.format(list(intersection)[0]))
  
          # Recursively check any contained superboxes.
          for box in boxes:
              if hasattr(box, 'box'):
                  self._check_jp2h_child_boxes(box.box, box.box_id)
docs: Certain boxes can only reside in the JP2 header.