def from_utc(utcTime, fmt=None):
 if (fmt is None):
  try_formats = ['%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M:%S']
 else:
  try_formats = [fmt]
 for fmt in try_formats:
  try:
   time_struct = datetime.datetime.strptime(utcTime, fmt)
  except ValueError:
   pass
  else:
   date = int(time.mktime(time_struct.timetuple()))
   return date
 else:
  raise ValueError('No UTC format matches {}'.format(utcTime))

def from_utc ( utcTime , fmt = None ) : if ( fmt is None ) : try_formats = [ '%Y-%m-%d %H:%M:%S.%f' , '%Y-%m-%d %H:%M:%S' ] else : try_formats = [ fmt ] for fmt in try_formats : try : time_struct = datetime . datetime . strptime ( utcTime , fmt ) except ValueError : pass else : date = int ( time . mktime ( time_struct . timetuple ( ) ) ) return date else : raise ValueError ( 'No UTC format matches {}' . format ( utcTime ) )
convert utc time string to time .