def total_seconds(td):
 if hasattr(td, 'total_seconds'):
  return td.total_seconds()
 else:
  return (((((td.days * 86400) + td.seconds) * (10 ** 6)) + td.microseconds) / (10.0 ** 6))

def total_seconds ( td ) : if hasattr ( td , 'total_seconds' ) : return td . total_seconds ( ) else : return ( ( ( ( ( td . days * 86400 ) + td . seconds ) * ( 10 ** 6 ) ) + td . microseconds ) / ( 10.0 ** 6 ) )
local total_seconds implementation for compatibility with python 2 .