'Atomically replaces the reconnection handler for this
host.  Intended for internal use only.'

def get_and_set_reconnection_handler(self, new_handler):

    with self.lock:
        old = self._reconnection_handler
        self._reconnection_handler = new_handler
        return old
