code: def load_tk_image(filename):
      
  
      if filename is None:
          return None
  
      if not os.path.isfile(filename):
          raise ValueError('Image file {} does not exist.'.format(filename))
  
      tk_image = None
  
      filename = os.path.normpath(filename)
      _, ext = os.path.splitext(filename)
  
      try:
          pil_image = PILImage.open(filename)
          tk_image = PILImageTk.PhotoImage(pil_image)
      except:
          try:
              # Fallback if PIL isn't available
              tk_image = tk.PhotoImage(file=filename)
          except:
              msg = "Cannot load {}.  Check to make sure it is an image file.".format(filename)
              try:
                  _ = PILImage
              except:
                  msg += "\nPIL library isn't installed.  If it isn't installed, only .gif files can be used."
              raise ValueError(msg)
      return tk_image
docs: Load in an image file and return as a tk Image.
  
      :param filename: image filename to load
      :return: tk Image object