def _validate_label(self, boxes):
        """
        Label boxes can only be inside association, codestream headers, or
        compositing layer header boxes.
        """
        for box in boxes:
            if box.box_id != 'asoc':
                if hasattr(box, 'box'):
                    for boxi in box.box:
                        if boxi.box_id == 'lbl ':
                            msg = ("A label box cannot be nested inside a "
                                   "{0} box.")
                            msg = msg.format(box.box_id)
                            raise IOError(msg)
                    # Same set of checks on any child boxes.
                    self._validate_label(box.box)
Label boxes can only be inside association, codestream headers, or
        compositing layer header boxes.