def datetime2epoch(dt):
 if (dt is not None):
  return calendar.timegm(dt.utctimetuple())

def datetime2epoch ( dt ) : if ( dt is not None ) : return calendar . timegm ( dt . utctimetuple ( ) )
convert a non-naive datetime object to a unix epoch timestamp .