code: def get_primary(self):
          
          # Implemented here in Topology instead of MongoClient, so it can lock.
          with self._lock:
              topology_type = self._description.topology_type
              if topology_type != TOPOLOGY_TYPE.ReplicaSetWithPrimary:
                  return None
  
              return writable_server_selector(self._new_selection())[0].address
docs: Return primary's address or None.