'Remove dead receivers from connections.'

def _remove_receiver(self, receiver):

    self.lock.acquire()
    try:
        to_remove = []
        for (key, connected_receiver) in self.receivers:
            if (connected_receiver == receiver):
                to_remove.append(key)
        for key in to_remove:
            last_idx = (len(self.receivers) - 1)
            for (idx, (r_key, _)) in enumerate(reversed(self.receivers)):
                if (r_key == key):
                    del self.receivers[(last_idx - idx)]
    finally:
        self.lock.release()
