From Mongo console I can use Javascript to get collections like,by using the following function
db.getCollectionNames().forEach(function(d){if(d.match(/_test$/)){print (d);}})
which gives all collections whose name end with test.
How can I do the same via python i.e pymongo