def s3_parse_datetime(string, dtfmt=None):
 if (not string):
  return None
 if (dtfmt is None):
  dtfmt = ISOFORMAT
 try:
  (y, m, d, hh, mm, ss, t0, t1, t2) = time.strptime(string, dtfmt)
  dt = datetime.datetime(y, m, d, hh, mm, ss)
 except ValueError:
  dt = None
 return dt

def s3_parse_datetime ( string , dtfmt = None ) : if ( not string ) : return None if ( dtfmt is None ) : dtfmt = ISOFORMAT try : ( y , m , d , hh , mm , ss , t0 , t1 , t2 ) = time . strptime ( string , dtfmt ) dt = datetime . datetime ( y , m , d , hh , mm , ss ) except ValueError : dt = None return dt
parse a date/time string according to the given format .