code: def to_string(self, endpoints):
          # type: (List[EndpointDescription]) -> str
          
          # Make the ElementTree
          root = self._make_xml(endpoints)
          tree = ElementTree.ElementTree(root)
  
          # Force the default name space
          ElementTree.register_namespace("", EDEF_NAMESPACE)
  
          # Make the XML
          # Prepare a StringIO output
          output = StringIO()
  
          # Try to write with a correct encoding
          tree.write(
              output,
              encoding=self._encoding,
              xml_declaration=self._xml_declaration,
          )
  
          return output.getvalue().strip()
docs: Converts the given endpoint description beans into a string
  
          :param endpoints: A list of EndpointDescription beans
          :return: A string containing an XML document