<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse(self, text):
 """Do the parsing."""


        text = tounicode(text, encoding="utf-8")
        result, i = self._parse(text, 0)
        if text[i:].strip():
            self._fail("Unexpected trailing content", text, i)
        return result