Hi @Vaseem_Akram_mohammad and welcome to the MongoDB community forum!!
The db.collection.getShardDistribution
is a helper function which works only in the mongosh
as of today.
The driver version of the command in pymongo are still not present in the latest release.
While there is no direct replacement of the command in Python, you may be able to get some part of the information by switching to the config database and perform some queries on the collections inside it. See Collections to Support Sharded Cluster Operations for more details on this.
However, please note that the contents of the config database are internal to MongoDB and may be subjected to change in future depending on the product requirement.
Let us know if you have any further queries.
Best Regards
Aasawari