docs: function selectServers(topology, selector, timeout, start, callback) {
    const duration = calculateDurationInMs(start);
    if (duration >= timeout) {
      return callback(new MongoTimeoutError(`Server selection timed out after ${timeout} ms`));
    }
  
    // ensure we are connected
    if (!topology.s.connected) {
      topology.connect();
  
      // we want to make sure we're still within the requested timeout window
      const failToConnectTimer = setTimeout(() => {
        topology.removeListener('connect', connectHandler);
        callback(new MongoTimeoutError('Server selection timed out waiting to connect'));
      }, timeout - duration);
  
      const connectHandler = () => {
        clearTimeout(failToConnectTimer);
        selectServers(topology, selector, timeout, process.hrtime(), callback);
      };
  
      topology.once('connect', connectHandler);
      return;
    }
  
    // otherwise, attempt server selection
    const serverDescriptions = Array.from(topology.description.servers.values());
    let descriptions;
  
    // support server selection by options with readPreference
    if (typeof selector === 'object') {
      const readPreference = selector.readPreference
        ? selector.readPreference
        : ReadPreference.primary;
  
      selector = readPreferenceServerSelector(readPreference);
    }
  
    try {
      descriptions = selector
        ? selector(topology.description, serverDescriptions)
        : serverDescriptions;
    } catch (e) {
      return callback(e, null);
    }
  
    if (descriptions.length) {
      const servers = descriptions.map(description => topology.s.servers.get(description.address));
      return callback(null, servers);
    }
  
    const retrySelection = () => {
      // ensure all server monitors attempt monitoring soon
      topology.s.servers.forEach(server => {
        setTimeout(
          () => server.monitor({ heartbeatFrequencyMS: topology.description.heartbeatFrequencyMS }),
          TOPOLOGY_DEFAULTS.minHeartbeatFrequencyMS
        );
      });
  
      const descriptionChangedHandler = () => {
        // successful iteration, clear the check timer
        clearTimeout(iterationTimer);
  
        if (topology.description.error) {
          callback(topology.description.error, null);
          return;
        }
  
        // topology description has changed due to monitoring, reattempt server selection
        selectServers(topology, selector, timeout, start, callback);
      };
  
      const iterationTimer = setTimeout(() => {
        topology.removeListener('topologyDescriptionChanged', descriptionChangedHandler);
        callback(new MongoTimeoutError(`Server selection timed out after ${timeout} ms`));
      }, timeout - duration);
  
      topology.once('topologyDescriptionChanged', descriptionChangedHandler);
    };
  
    retrySelection();
  }