def METHOD_NAME(self, engagement: EngagementWithCredentials) -> float:
    engagement_time_left = parsedate(engagement.expires_at) - datetime.now(tzutc())
    return min(self.timeout, engagement_time_left.total_seconds())