def _write(self, img_array, verbose=False, **kwargs):
if re.match("<STR_LIT>", version.openjpeg_version) is not None:<EOL><INDENT>msg = ("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>raise RuntimeError(msg)<EOL><DEDENT>self._determine_colorspace(**kwargs)<EOL>self._populate_cparams(img_array, **kwargs)<EOL>if opj2.OPENJP2 is not None:<EOL><INDENT>self._write_openjp2(img_array, verbose=verbose)<EOL><DEDENT>else:<EOL><INDENT>self._write_openjpeg(img_array, verbose=verbose)<EOL><DEDENT>
Write image data to a JP2/JPX/J2k file.  Intended usage of the
        various parameters follows that of OpenJPEG's opj_compress utility.

        This method can only be used to create JPEG 2000 images that can fit
        in memory.