migrating away from timedelta.total_seconds() which is Python 2.7+