def __init__(self, topology, topology_settings):
        """Class to poll SRV records on a background thread.

        Pass a Topology and a TopologySettings.

        The Topology is weakly referenced.
        """
        self._settings = topology_settings
        self._seedlist = self._settings._seeds
        self._fqdn = self._settings.fqdn

        # We strongly reference the executor and it weakly references us via
        # this closure. When the monitor is freed, stop the executor soon.
        def target():
            monitor = self_ref()
            if monitor is None:
                return False  # Stop the executor.
            SrvMonitor._run(monitor)
            return True

        executor = periodic_executor.PeriodicExecutor(
            interval=common.MIN_SRV_RESCAN_INTERVAL,
            min_interval=self._settings.heartbeat_frequency,
            target=target,
            name="pymongo_srv_polling_thread")

        self._executor = executor

        # Avoid cycles. When self or topology is freed, stop executor soon.
        self_ref = weakref.ref(self, executor.close)
        self._topology = weakref.proxy(topology, executor.close)
Class to poll SRV records on a background thread.

        Pass a Topology and a TopologySettings.

        The Topology is weakly referenced.
        
stackoverflow/venv/lib/python3.6/site-packages/pymongo/monitor.py