code: def apply_effect(layer, image):
      
      for effect in layer.effects:
          if effect.__class__.__name__ == 'PatternOverlay':
              draw_pattern_fill(image, layer._psd, effect.value)
  
      for effect in layer.effects:
          if effect.__class__.__name__ == 'GradientOverlay':
              draw_gradient_fill(image, effect.value)
  
      for effect in layer.effects:
          if effect.__class__.__name__ == 'ColorOverlay':
              draw_solid_color_fill(image, effect.value)
docs: Apply effect to the image.
  
      ..note: Correct effect order is the following. All the effects are first
          applied to the original image then blended together.
  
          * dropshadow
          * outerglow
          * (original)
          * patternoverlay
          * gradientoverlay
          * coloroverlay
          * innershadow
          * innerglow
          * bevelemboss
          * satin
          * stroke