def _date_to_unix(arg):
 if isinstance(arg, datetime):
  arg = arg.utctimetuple()
 elif isinstance(arg, (integer_types + (float,))):
  return int(arg)
 (year, month, day, hour, minute, second) = arg[:6]
 days = (((date(year, month, 1).toordinal() - _epoch_ord) + day) - 1)
 hours = ((days * 24) + hour)
 minutes = ((hours * 60) + minute)
 seconds = ((minutes * 60) + second)
 return seconds

def _date_to_unix ( arg ) : if isinstance ( arg , datetime ) : arg = arg . utctimetuple ( ) elif isinstance ( arg , ( integer_types + ( float , ) ) ) : return int ( arg ) ( year , month , day , hour , minute , second ) = arg [ : 6 ] days = ( ( ( date ( year , month , 1 ) . toordinal ( ) - _epoch_ord ) + day ) - 1 ) hours = ( ( days * 24 ) + hour ) minutes = ( ( hours * 60 ) + minute ) seconds = ( ( minutes * 60 ) + second ) return seconds
converts a timetuple .