def paste_with_alpha(target, source, left_upper, opacity):
    'An alpha_composite-like operation.'
    mask = Image.new('L', source.size, opacity)
    target.paste(source, left_upper, mask=mask)
An alpha_composite-like operation.
def paste_with_alpha(target, source, left_upper, opacity):
    
    mask = Image.new('L', source.size, opacity)
    target.paste(source, left_upper, mask=mask)