def timegm(year, month, day, hour, minute, second):
 EPOCH = 1970
 if (year < EPOCH):
  raise ValueError(('Years prior to %d not supported' % (EPOCH,)))
 assert (1 <= month <= 12)
 days = ((365 * (year - EPOCH)) + calendar.leapdays(EPOCH, year))
 for i in range(1, month):
  days = (days + calendar.mdays[i])
 if ((month > 2) and calendar.isleap(year)):
  days = (days + 1)
 days = ((days + day) - 1)
 hours = ((days * 24) + hour)
 minutes = ((hours * 60) + minute)
 seconds = ((minutes * 60) + second)
 return seconds

def timegm ( year , month , day , hour , minute , second ) : EPOCH = 1970 if ( year < EPOCH ) : raise ValueError ( ( 'Years prior to %d not supported' % ( EPOCH , ) ) ) assert ( 1 <= month <= 12 ) days = ( ( 365 * ( year - EPOCH ) ) + calendar . leapdays ( EPOCH , year ) ) for i in range ( 1 , month ) : days = ( days + calendar . mdays [ i ] ) if ( ( month > 2 ) and calendar . isleap ( year ) ) : days = ( days + 1 ) days = ( ( days + day ) - 1 ) hours = ( ( days * 24 ) + hour ) minutes = ( ( hours * 60 ) + minute ) seconds = ( ( minutes * 60 ) + second ) return seconds
convert time tuple in gmt to seconds since epoch .