code: def as_PIL(self):
          
          if isinstance(self.data, numpy.ndarray):
              if self.data.dtype == numpy.uint8:
                  result = PIL.Image.fromarray(self.data)
              else:
                  result = PIL.Image.fromarray(
                      self.data.clip(0, 255).astype(numpy.uint8))
          elif isinstance(self.data, PIL.Image.Image):
              result = self.data
          else:
              raise RuntimeError(
                  'Cannot convert "%s" to PIL' % self.data.__class__.__name__)
          return result
docs: Get image data in :py:mod:`PIL:PIL.Image` form.
  
          Note that if the image data is already in the correct format
          this is a null operation.
  
          :return: The image data as :py:mod:`PIL:PIL.Image`.
  
          :rtype: :py:mod:`PIL:PIL.Image`