def to_time(wmi_time):
 def int_or_none(s, start, end):
  try:
   return int(s[start:end])
  except ValueError:
   return None
 year = int_or_none(wmi_time, 0, 4)
 month = int_or_none(wmi_time, 4, 6)
 day = int_or_none(wmi_time, 6, 8)
 hours = int_or_none(wmi_time, 8, 10)
 minutes = int_or_none(wmi_time, 10, 12)
 seconds = int_or_none(wmi_time, 12, 14)
 microseconds = int_or_none(wmi_time, 15, 21)
 timezone = wmi_time[22:]
 if (timezone == '***'):
  timezone = None
 return (year, month, day, hours, minutes, seconds, microseconds, timezone)

def to_time ( wmi_time ) : def int_or_none ( s , start , end ) : try : return int ( s [ start : end ] ) except ValueError : return None year = int_or_none ( wmi_time , 0 , 4 ) month = int_or_none ( wmi_time , 4 , 6 ) day = int_or_none ( wmi_time , 6 , 8 ) hours = int_or_none ( wmi_time , 8 , 10 ) minutes = int_or_none ( wmi_time , 10 , 12 ) seconds = int_or_none ( wmi_time , 12 , 14 ) microseconds = int_or_none ( wmi_time , 15 , 21 ) timezone = wmi_time [ 22 : ] if ( timezone == '***' ) : timezone = None return ( year , month , day , hours , minutes , seconds , microseconds , timezone )
just return any time struct .