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