after

client=MongoClient('mongodb+srv://yourname:yourpassword@yourcluster.mongodb.net'

(or however you get your MongoClient instance)

db=client.foo
print(db.command({'connectionStatus': 1}))

works for me.