def pop(self, uri=None):
    top = self.element_stack.pop()
    if uri:
        assert (uri == top)
    write = self.stream.write
    if (not self.closed):
        self.closed = True
        write('/>')
    else:
        if self.parent:
            write('\n')
            write(self.indent)
        write(('</%s>' % self.qname(top)))
    self.parent = True
def pop(self, uri=None):
    top = self.element_stack.pop()
    if uri:
        assert (uri == top)
    write = self.stream.write
    if (not self.closed):
        self.closed = True
        write('/>')
    else:
        if self.parent:
            write('\n')
            write(self.indent)
        write(('</%s>' % self.qname(top)))
    self.parent = True