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. An 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