def dump(self,filename=None):
        """
        Dumps the object to an output filename (or open file descriptor). The filename
        parameter is optional, and if it is not provided, the standard output will be used
        @type filename: string or file descriptor
        @param filename: file where to dump the object (default standard output)
        """

        if filename is None:
            with io.BytesIO() as buffer:
                self.dump(filename=buffer)
                bytes = buffer.getvalue()
                getattr(sys.stdout, 'buffer', sys.stdout).write(bytes)
        else:
            self.tree.write(filename,encoding='UTF-8',pretty_print=True,xml_declaration=True)
Dumps the object to an output filename (or open file descriptor). The filename
        parameter is optional, and if it is not provided, the standard output will be used
        @type filename: string or file descriptor
        @param filename: file where to dump the object (default standard output)