def check_token(self, user, token):
<EOL>try:<EOL><INDENT>ts_b36, hash = token.split('<STR_LIT:->')<EOL><DEDENT>except ValueError:<EOL><INDENT>return False<EOL><DEDENT>try:<EOL><INDENT>ts = base36_to_int(ts_b36)<EOL><DEDENT>except ValueError:<EOL><INDENT>return False<EOL><DEDENT>if not constant_time_compare(self._make_token_with_timestamp(user, ts), token):<EOL><INDENT>return False<EOL><DEDENT>if (self._num_days(self._today()) - ts) > settings.USERS_EMAIL_CONFIRMATION_TIMEOUT_DAYS:<EOL><INDENT>return False<EOL><DEDENT>return True<EOL>
Check that a activation token is correct for a given user.