code: def _is_image(self, var):
          
          try:
              from PIL import Image
              return isinstance(var, Image.Image)
          except:
              return False
docs: Return True if variable is a PIL.Image image