docs: def pil_image(self):
          """Return a PIL image from the current image.
          """
          channels, fill_value = self._finalize()
  
          if self.is_empty():
              return Pil.new(self.mode, (0, 0))
  
          if self.mode == "L":
              if fill_value is not None:
                  img = Pil.fromarray(channels[0].filled(fill_value))
              else:
                  img = Pil.fromarray(channels[0].filled(0))
                  alpha = np.zeros(channels[0].shape, np.uint8)
                  mask = np.ma.getmaskarray(channels[0])
                  alpha = np.where(mask, alpha, 255)
                  pil_alpha = Pil.fromarray(alpha)
  
                  img = Pil.merge("LA", (img, pil_alpha))
          elif self.mode == "LA":
              if fill_value is not None:
                  img = Pil.fromarray(channels[0].filled(fill_value))
                  pil_alpha = Pil.fromarray(channels[1])
              else:
                  img = Pil.fromarray(channels[0].filled(0))
                  alpha = np.zeros(channels[0].shape, np.uint8)
                  mask = np.ma.getmaskarray(channels[0])
                  alpha = np.where(mask, alpha, channels[1])
                  pil_alpha = Pil.fromarray(alpha)
              img = Pil.merge("LA", (img, pil_alpha))
  
          elif self.mode == "RGB":
              # Mask where all channels have missing data (incomplete data will
              # be shown).
              mask = (np.ma.getmaskarray(channels[0]) &
                      np.ma.getmaskarray(channels[1]) &
                      np.ma.getmaskarray(channels[2]))
  
              if fill_value is not None:
                  pil_r = Pil.fromarray(channels[0].filled(fill_value[0]))
                  pil_g = Pil.fromarray(channels[1].filled(fill_value[1]))
                  pil_b = Pil.fromarray(channels[2].filled(fill_value[2]))
                  img = Pil.merge("RGB", (pil_r, pil_g, pil_b))
              else:
                  pil_r = Pil.fromarray(channels[0].filled(0))
                  pil_g = Pil.fromarray(channels[1].filled(0))
                  pil_b = Pil.fromarray(channels[2].filled(0))
  
                  alpha = np.zeros(channels[0].shape, np.uint8)
                  alpha = np.where(mask, alpha, 255)
                  pil_a = Pil.fromarray(alpha)
  
                  img = Pil.merge("RGBA", (pil_r, pil_g, pil_b, pil_a))
  
          elif self.mode == "RGBA":
              # Mask where all channels have missing data (incomplete data will
              # be shown).
              mask = (np.ma.getmaskarray(channels[0]) &
                      np.ma.getmaskarray(channels[1]) &
                      np.ma.getmaskarray(channels[2]) &
                      np.ma.getmaskarray(channels[3]))
  
              if fill_value is not None:
                  pil_r = Pil.fromarray(channels[0].filled(fill_value[0]))
                  pil_g = Pil.fromarray(channels[1].filled(fill_value[1]))
                  pil_b = Pil.fromarray(channels[2].filled(fill_value[2]))
                  pil_a = Pil.fromarray(channels[3].filled(fill_value[3]))
                  img = Pil.merge("RGBA", (pil_r, pil_g, pil_b, pil_a))
              else:
                  pil_r = Pil.fromarray(channels[0].filled(0))
                  pil_g = Pil.fromarray(channels[1].filled(0))
                  pil_b = Pil.fromarray(channels[2].filled(0))
  
                  alpha = np.where(mask, 0, channels[3])
                  pil_a = Pil.fromarray(alpha)
  
                  img = Pil.merge("RGBA", (pil_r, pil_g, pil_b, pil_a))
  
          else:
              raise TypeError("Does not know how to use mode %s." % (self.mode))
  
          return img