<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_tile_data(codec, tidx, data, data_size, stream):
 """Reads tile data. Wraps the openjp2 library function opj_decode_tile_data. Parameters codec : CODEC_TYPE The JPEG2000 codec tile_index : int The index of the tile being decoded data : array Holds a memory block into which data will be decoded. data_size : int The size of data in bytes stream : STREAM_TYPE_P The stream to decode. Raises ------ RuntimeError If the OpenJPEG library routine opj_decode fails. """

    OPENJP2.opj_decode_tile_data.argtypes = [CODEC_TYPE,
                                             ctypes.c_uint32,
                                             ctypes.POINTER(ctypes.c_uint8),
                                             ctypes.c_uint32,
                                             STREAM_TYPE_P]
    OPENJP2.opj_decode_tile_data.restype = check_error

    datap = data.ctypes.data_as(ctypes.POINTER(ctypes.c_uint8))
    OPENJP2.opj_decode_tile_data(codec,
                                 ctypes.c_uint32(tidx),
                                 datap,
                                 ctypes.c_uint32(data_size),
                                 stream)