def _total_seconds(td): # Python 2.6 doesn't have a total_seconds() method on timedelta objects return ((td.seconds + td.days * 86400) * 1000000 + td.microseconds) // 1000000