Get a value from an RDF triple

def _get_triplet_value(self, graph, identity, rdf_type):
        """
        Get a value from an RDF triple
        """
        value = graph.value(subject=identity, predicate=rdf_type)
        return value.toPython() if value is not None else value