Maybe that's impossible, but if ``connection`` is not in ``self.pool.iteritems()`` then you will wrongly delete the last connection of that group.