def reduce_opacity(im, opacity):
assert opacity >= <NUM_LIT:0> and opacity <= <NUM_LIT:1><EOL>if im.mode != '<STR_LIT>':<EOL><INDENT>im = im.convert('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>im = im.copy()<EOL><DEDENT>alpha = im.split()[<NUM_LIT:3>]<EOL>alpha = ImageEnhance.Brightness(alpha).enhance(opacity)<EOL>im.putalpha(alpha)<EOL>return im<EOL>
Returns an image with reduced opacity.