code: def get_tile_image(self, x, y, layer):
          
          try:
              assert (x >= 0 and y >= 0)
          except AssertionError:
              raise ValueError
  
          try:
              layer = self.layers[layer]
          except IndexError:
              raise ValueError
  
          assert (isinstance(layer, TiledTileLayer))
  
          try:
              gid = layer.data[y][x]
          except (IndexError, ValueError):
              raise ValueError
          except TypeError:
              msg = "Tiles must be specified in integers."
              logger.debug(msg)
              raise TypeError
  
          else:
              return self.get_tile_image_by_gid(gid)
docs: Return the tile image for this location
  
          :param x: x coordinate
          :param y: y coordinate
          :param layer: layer number
          :rtype: surface if found, otherwise 0