code: def _apply_icc(image, icc_profile):
      
      from io import BytesIO
      try:
          from PIL import ImageCms
      except ImportError:
          logger.debug(
              'ICC profile found but not supported. Install little-cms.'
          )
          return image
  
      if image.mode not in ('RGB',):
          logger.debug('%s ICC profile is not supported.' % image.mode)
          return image
  
      try:
          in_profile = ImageCms.ImageCmsProfile(BytesIO(icc_profile))
          out_profile = ImageCms.createProfile('sRGB')
          return ImageCms.profileToProfile(image, in_profile, out_profile)
      except ImageCms.PyCMSError as e:
          logger.warning('PyCMSError: %s' % (e))
  
      return image
docs: Apply ICC Color profile.