#NEWLINE# def expiration_datetime( self ) : #NEWLINE# #INDENT# "Return provider session live seconds. Returns a timedelta ready to\n        use with session.set_expiry().\n\n        If provider returns a timestamp instead of session seconds to live, the\n        timedelta is inferred from current time (using UTC timezone). None is\n        returned if there's no value stored or it's invalid.\n        " #NEWLINE# if ( self . extra_data and ( 'expires' in self . extra_data ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# expires = int ( self . extra_data . get ( 'expires' ) ) #NEWLINE# #UNINDENT# except ( ValueError , TypeError ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# now = datetime . utcnow ( ) #NEWLINE# if ( expires > time . mktime ( now . timetuple ( ) ) ) : #NEWLINE# #INDENT# return ( datetime . fromtimestamp ( expires ) - now ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return timedelta ( seconds = expires )