'Return provider session live seconds. Returns a timedelta ready to
use with session.set_expiry().
If provider returns a timestamp instead of session seconds to live, the
timedelta is inferred from current time (using UTC timezone). None is
returned if there\'s no value stored or it\'s invalid.'

def expiration_datetime(self):

    if (self.extra_data and ('expires' in self.extra_data)):
        try:
            expires = int(self.extra_data['expires'])
        except (ValueError, TypeError):
            return None
        now = datetime.utcnow()
        if (expires > time.mktime(now.timetuple())):
            return (datetime.fromtimestamp(expires) - now)
        else:
            return timedelta(seconds=expires)
