code: def total_seconds(offset):
      
      seconds = offset.days * 24 * 60 * 60 + offset.seconds
      microseconds = seconds * 10**6 + offset.microseconds
      return microseconds / (10**6 * 1.0)
docs: Backport of offset.total_seconds() from python 2.7+.