<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def attempt(self, *kinds):
 """Try to get the next token if it matches one of the kinds given, otherwise returning None. If no kinds are given, any kind is accepted."""

        if self._error:
            raise self._error
        token = self.next_token
        if not token:
            return None
        if kinds and token.kind not in kinds:
            return None
        self._advance()
        return token