def _message_from_token(self, token: Text, payload: Any)-> Optional[BaseMessage]:
try:<EOL><INDENT>tk = jwt.decode(token, settings.WEBVIEW_SECRET_KEY)<EOL><DEDENT>except jwt.InvalidTokenError:<EOL><INDENT>return<EOL><DEDENT>try:<EOL><INDENT>user_id = tk['<STR_LIT>']<EOL>assert isinstance(user_id, Text)<EOL>page_id = tk['<STR_LIT>']<EOL>assert isinstance(page_id, Text)<EOL><DEDENT>except (KeyError, AssertionError):<EOL><INDENT>return<EOL><DEDENT>if self.settings()['<STR_LIT>'] == page_id:<EOL><INDENT>return self._make_fake_message(user_id, page_id, payload)<EOL><DEDENT>
Analyzes a signed token and generates the matching message