'Clean up the stale connections in all of the pools, and then
get rid of empty pools.  Pools clean themselves every time a
connection is fetched; this cleaning takes care of pools that
aren\'t being used any more, so nothing is being gotten from
them.'

def clean(self):

    with self.mutex:
        now = time.time()
        if ((self.last_clean_time + self.CLEAN_INTERVAL) < now):
            to_remove = []
            for (host, pool) in self.host_to_pool.items():
                pool.clean()
                if (pool.size() == 0):
                    to_remove.append(host)
            for host in to_remove:
                del self.host_to_pool[host]
            self.last_clean_time = now
