code: def encode(codec, stream):
      
      OPENJP2.opj_encode.argtypes = [CODEC_TYPE, STREAM_TYPE_P]
      OPENJP2.opj_encode.restype = check_error
  
      OPENJP2.opj_encode(codec, stream)
docs: Wraps openjp2 library function opj_encode.
  
      Encode an image into a JPEG 2000 codestream.
  
      Parameters
      ----------
      codec : CODEC_TYPE
          The jpeg2000 codec.
      stream : STREAM_TYPE_P
          The stream to which data is written.
  
      Raises
      ------
      RuntimeError
          If the OpenJPEG library routine opj_encode fails.