code: def _timedelta_total_seconds(td):
      
      if hasattr(timedelta, "total_seconds"):
          return getattr(td, "total_seconds")()
  
      # Python 2.6 backward compatibility
      return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / float(10**6)
docs: Python 2.6 backward compatibility function for timedelta.total_seconds.
  
      :type td: timedelta object
      :param td: timedelta object
  
      :rtype: float
      :return: The total number of seconds for the given timedelta object.