code: def colorize(self, colormap):
          
  
          if self.mode not in ("L", "LA"):
              raise ValueError("Image should be grayscale to colorize")
          if self.mode == "LA":
              alpha = self.channels[1]
          else:
              alpha = None
          self.channels = colormap.colorize(self.channels[0])
          if alpha is not None:
              self.channels.append(alpha)
              self.mode = "RGBA"
          else:
              self.mode = "RGB"
docs: Colorize the current image using
          *colormap*. Works only on"L" or "LA" images.