<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def endSections(self, level=u'0'):
 """Closes all sections of level >= sectnum. Defaults to closing all open sections"""


        iSectionsClosed = self.storeSectionState(level)
        self.document.append("</section>\n" * iSectionsClosed)