added to support python version < 2.7, otherwise timedelta has total_seconds()