Closes the most recently opened element.

    :name: if given, this value must match the name given for the most recently opened element. This
           is primarily here for providing quick error checking for applications

def close(self, name=None):
    """Closes the most recently opened element.

    :name: if given, this value must match the name given for the most recently opened element. This
           is primarily here for providing quick error checking for applications
    """
    tag = self._open_elements.pop()
    if name is not None and name != tag:
      raise Exception("Tag closing mismatch")
    self._pad()
    self._writer.endElement(_normalize_name(tag))
    self._newline()