@classmethod<EOL><INDENT>def parse(cls, fptr, offset, length):<DEDENT>
num_bytes = offset + length - fptr.tell()<EOL>read_buffer = fptr.read(num_bytes)<EOL>lst = struct.unpack_from('<STR_LIT>', read_buffer, offset=<NUM_LIT:0>)<EOL>method, precedence, approximation = lst<EOL>if method == <NUM_LIT:1>:<EOL><INDENT>colorspace, = struct.unpack_from('<STR_LIT>', read_buffer, offset=<NUM_LIT:3>)<EOL>if colorspace not in _COLORSPACE_MAP_DISPLAY.keys():<EOL><INDENT>msg = "<STR_LIT>"<EOL>msg = msg.format(colorspace=colorspace)<EOL>warnings.warn(msg, UserWarning)<EOL><DEDENT>icc_profile = None<EOL><DEDENT>else:<EOL><INDENT>colorspace = None<EOL>if (num_bytes - <NUM_LIT:3>) < <NUM_LIT>:<EOL><INDENT>msg = ("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>warnings.warn(msg.format(length=num_bytes - <NUM_LIT:3>), UserWarning)<EOL>icc_profile = None<EOL><DEDENT>else:<EOL><INDENT>profile = _ICCProfile(read_buffer[<NUM_LIT:3>:])<EOL>icc_profile = profile.header<EOL><DEDENT><DEDENT>return cls(method=method,<EOL>precedence=precedence,<EOL>approximation=approximation,<EOL>colorspace=colorspace,<EOL>icc_profile=icc_profile,<EOL>length=length,<EOL>offset=offset)<EOL>
Parse JPEG 2000 color specification box.

        Parameters
        ----------
        fptr : file
            Open file object.
        offset : int
            Start position of box in bytes.
        length : int
            Length of the box in bytes.

        Returns
        -------
        ColourSpecificationBox
            Instance of the current colour specification box.