'Get session the expiry date (as a datetime object).
Optionally, this function accepts `modification` and `expiry` keyword
arguments specifying the modification and expiry of the session.'

def get_expiry_date(self, **kwargs):

    try:
        modification = kwargs['modification']
    except KeyError:
        modification = timezone.now()
    try:
        expiry = kwargs['expiry']
    except KeyError:
        expiry = self.get('_session_expiry')
    if isinstance(expiry, datetime):
        return expiry
    if (not expiry):
        expiry = settings.SESSION_COOKIE_AGE
    return (modification + timedelta(seconds=expiry))
