code: def serialize(self, format):
          
          if PY3:
              return self.prov_g.serialize(format=format).decode('utf-8')
          else:
              return self.prov_g.serialize(format=format)
docs: Serialize provenance graph in the specified format