code: def write(graph, fileformat=None, filename=None):
          
  
          filewriter = None
          if fileformat is None:
              fileformat = 'turtle'
          if filename is not None:
  
              with open(filename, 'wb') as filewriter:
                  LOG.info("Writing triples in %s to %s", fileformat, filename)
                  # rdflib serialize
                  graph.serialize(filewriter, format=fileformat)
          else:
              print(graph.serialize(fileformat).decode())
          return
docs: A basic graph writer (to stdout) for any of the sources.
          this will write raw triples in rdfxml, unless specified.
          to write turtle, specify format='turtle'
          an optional file can be supplied instead of stdout
          :return: None