code: def group(self, coords):
          
  
          groups = []
          for i in range(len(self.zoom_range_items)):
              groups.append([])
  
          # first group the coordinates based on their queue
          for coord in coords:
              for i, zri in enumerate(self.zoom_range_items):
                  toi_match = zri.in_toi is None or \
                              (coord in self.toi_set) == zri.in_toi
                  if zri.start <= coord.zoom < zri.end and toi_match:
                      groups[i].append(coord)
                      break
  
          # now, we need to just verify that for each particular group,
          # should they be further grouped, eg by a particular zoom 10
          # tile
          for i, zri in enumerate(self.zoom_range_items):
              group = groups[i]
              if not group:
                  continue
              if zri.group_by_zoom is None:
                  for coord in group:
                      yield CoordGroup([coord], zri.queue_id)
              else:
                  by_parent_coords = defaultdict(list)
                  for coord in group:
                      if coord.zoom >= zri.group_by_zoom:
                          group_coord = coord.zoomTo(zri.group_by_zoom)
                          group_key = coord_marshall_int(group_coord)
                          by_parent_coords[group_key].append(coord)
                      else:
                          # this means that a coordinate belonged to a
                          # particular queue but the zoom was lower than
                          # the group by zoom
                          # this probably shouldn't happen
                          # should it be an assert instead?
                          yield CoordGroup([coord], zri.queue_id)
  
                  for group_key, coords in by_parent_coords.iteritems():
                      yield CoordGroup(coords, zri.queue_id)
docs: return CoordGroups that can be used to send to queues
  
          Each CoordGroup represents a message that can be sent to a
          particular queue, stamped with the queue_id. The list of
          coords, which can be 1, is what should get used for the
          payload for each queue message.