def getReturnPage(siteHistory,prior=False):
expiry = parse_datetime(<EOL>siteHistory.get('<STR_LIT>','<STR_LIT>'),<EOL>)<EOL>if prior:<EOL><INDENT>returnPage = siteHistory.get('<STR_LIT>',None)<EOL>returnPageName = siteHistory.get('<STR_LIT>',None)<EOL><DEDENT>else:<EOL><INDENT>returnPage = siteHistory.get('<STR_LIT>',None)<EOL>returnPageName = siteHistory.get('<STR_LIT>',None)<EOL><DEDENT>if expiry and expiry >= timezone.now() and returnPage[<NUM_LIT:0>]:<EOL><INDENT>return {<EOL>'<STR_LIT:url>': reverse(returnPage[<NUM_LIT:0>],kwargs=returnPage[<NUM_LIT:1>]),<EOL>'<STR_LIT:title>': returnPageName,<EOL>}<EOL><DEDENT>else:<EOL><INDENT>return {'<STR_LIT:url>': None, '<STR_LIT:title>': None}<EOL><DEDENT>
This helper function is called in various places to get the return page from current
session data.  The session data (in the 'SITE_HISTORY' key) is a required argument.