<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _reduce_opacity(self, watermark, opacity):
 """ Returns an image with reduced opacity. Converts image to RGBA if needs. Simple watermark.opacity(65535 - int(65535 * opacity) would not work for images with the Opacity channel (RGBA images). So we have to convert RGB or any other type to RGBA in this case """


        if watermark.type() != ImageType.TrueColorMatteType:
            watermark.type(ImageType.TrueColorMatteType)
        depth = 255 - int(255 * opacity)
        watermark.quantumOperator(ChannelType.OpacityChannel, QuOp.MaxQuantumOp, depth)