With the help e.g. of wikidata_query(...) it is simple to perform queries to wikidata from python:
E.g.
q = "&q