def ensure_utc(time, tz='UTC'):
 if (not time.tzinfo):
  time = time.replace(tzinfo=pytz.timezone(tz))
 return time.replace(tzinfo=pytz.utc)

def ensure_utc ( time , tz = 'UTC' ) : if ( not time . tzinfo ) : time = time . replace ( tzinfo = pytz . timezone ( tz ) ) return time . replace ( tzinfo = pytz . utc )
normalize a time .