code: def get_tile_properties_by_layer(self, layer):
          
          try:
              assert (int(layer) >= 0)
              layer = int(layer)
          except (TypeError, AssertionError):
              msg = "Layer must be a positive integer.  Got {0} instead."
              logger.debug(msg.format(type(layer)))
              raise ValueError
  
          p = product(range(self.width), range(self.height))
          layergids = set(self.layers[layer].data[y][x] for x, y in p)
  
          for gid in layergids:
              try:
                  yield gid, self.tile_properties[gid]
              except KeyError:
                  continue
docs: Get the tile properties of each GID in layer
  
          :param layer: layer number
          :rtype: iterator of (gid, properties) tuples