def to_string(self, endpoints):
        """
        Converts the given endpoint description beans into a string

        :param endpoints: A list of EndpointDescription beans
        :return: A string containing an XML document
        """
        # 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
        for encoding in "unicode", "UTF-8":
            # Prepare a StringIO output
            output = StringIO()

            try:
                # Try to write with a correct encoding
                tree.write(
                    output,
                    encoding=encoding,
                    xml_declaration=True,
                    method="xml",
                )
                break

            except LookupError:
                # 'unicode' is needed in Python 3, but unknown in Python 2...
                continue

        else:
            raise LookupError("Couldn't find a valid encoding")

        return output.getvalue()
Converts the given endpoint description beans into a string

        :param endpoints: A list of EndpointDescription beans
        :return: A string containing an XML document