SPARQL Wrapper is a SPARQL Endpoint interface to Python
I found sample code at https://github.com/RDFLib/sparqlwrapper/blob/master/scripts/example.py which I modified slightly from …