code: def timedelta_seconds(timedelta):
      
      return (timedelta.total_seconds() if hasattr(timedelta, "total_seconds")
              else timedelta.days * 24 * 3600 + timedelta.seconds +
                   timedelta.microseconds / 1000000.)
docs: Returns the total timedelta duration in seconds.