<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def decode(codec, stream, image):
 """Reads an entire image. Wraps the openjp2 library function opj_decode. Parameters codec : CODEC_TYPE The JPEG2000 codec stream : STREAM_TYPE_P The stream to decode. image : ImageType Output image structure. Raises ------ RuntimeError If the OpenJPEG library routine opj_decode fails. """

    OPENJP2.opj_decode.argtypes = [CODEC_TYPE, STREAM_TYPE_P,
                                   ctypes.POINTER(ImageType)]
    OPENJP2.opj_decode.restype = check_error

    OPENJP2.opj_decode(codec, stream, image)