'Get the number of seconds until the session expires.'

def get_expiry_age(self):

    expiry = self.get('_session_expiry')
    if (not expiry):
        return settings.SESSION_COOKIE_AGE
    if (not isinstance(expiry, datetime)):
        return expiry
    delta = (expiry - datetime.now())
    return ((delta.days * 86400) + delta.seconds)
