Handling of pythons without timedelta.total_seconds()