get a generator of the list of Wanted:Templates/subtemplates in order to copy all the Wikipedia templates needed on a target wiki thanks to the script transfertbot.py
The list of wanted templates could be find on :
target.wiki/Special:WantedTemplates
and thnaks to api
target.wiki/Special:ApiSandbox#action=query&format=json&prop=categories&list=querypage&qppage=Wantedtemplates
Because of many dependencies this script will has to be run several times to get all the templates wanted