def dt_to_timestamp(dt):
 if dt.tzinfo:
  td = (dt - EPOCH_AWARE)
 else:
  td = (dt - EPOCH_NAIVE)
 return total_seconds(td)

def dt_to_timestamp ( dt ) : if dt . tzinfo : td = ( dt - EPOCH_AWARE ) else : td = ( dt - EPOCH_NAIVE ) return total_seconds ( td )
converts from a :class:~datetime .