code: def serialize(self, format="turtle"):
          
          if self.triples:
              if not self.rdfgraph:
                  self._buildGraph()
              return self.rdfgraph.serialize(format=format)
          else:
              return None
docs: xml, n3, turtle, nt, pretty-xml, trix are built in