code: def write(self, f):
          
          rdf = ET.Element(NS('rdf', 'RDF'), nsmap=XML_NS)
  
          # TODO: TopLevel Annotations
          sequence_values = sorted(self._sequences.values(), key=lambda x: x.identity)
          self._add_to_root(rdf, sequence_values)
          component_values = sorted(self._components.values(), key=lambda x: x.identity)
          self._add_to_root(rdf, component_values)
          model_values = sorted(self._models.values(), key=lambda x: x.identity)
          self._add_to_root(rdf, model_values)
          module_values = sorted(self._modules.values(), key=lambda x: x.identity)
          self._add_to_root(rdf, module_values)
          collection_values = sorted(self._collections.values(), key=lambda x: x.identity)
          self._add_to_root(rdf, collection_values)
          annotation_values = sorted(self._annotations.values(), key=lambda x: x.identity)
          self._add_to_root(rdf, annotation_values)
  
          f.write(ET.tostring(rdf,
                              pretty_print=True,
                              xml_declaration=True,
                              encoding='utf-8'))
docs: Write an SBOL file from current document contents