<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _handle_wikilink(self, token):
 """Handle a case where a wikilink is at the head of the tokens."""

        title = None
        self._push()
        while self._tokens:
            token = self._tokens.pop()
            if isinstance(token, tokens.WikilinkSeparator):
                title = self._pop()
                self._push()
            elif isinstance(token, tokens.WikilinkClose):
                if title is not None:
                    return Wikilink(title, self._pop())
                return Wikilink(self._pop())
            else:
                self._write(self._handle_token(token))
        raise ParserError("_handle_wikilink() missed a close token")