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:

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