Support python2.6 by re-implementing timedelta.total_seconds()