Using SPARQL via Python

RDFLIB is a Python library for reading XML/RDF formatted OWL ontologies directly, and provides SPARQL querying on them. It provides comprehensive querying and RDF or tabular results.  A stand-alone Python 2.7 example is here:
https://github.com/GenEpiO/genepio/blob/master/src/ontology/ontology_query.py

A more elaborate Python 3 example is here, containing queries that fetch branches of an ontology starting from a given URI:

https://github.com/Public-Health-Bioinformatics/ontofetch/blob/master/ontofetch.py