def _to_micros(dur):
 if hasattr(dur, 'total_seconds'):
  return int((dur.total_seconds() * 1000000.0))
 return (dur.microseconds + ((dur.seconds + ((dur.days * 24) * 3600)) * 1000000))

def _to_micros ( dur ) : if hasattr ( dur , 'total_seconds' ) : return int ( ( dur . total_seconds ( ) * 1000000.0 ) ) return ( dur . microseconds + ( ( dur . seconds + ( ( dur . days * 24 ) * 3600 ) ) * 1000000 ) )
convert duration dur to microseconds .