def s3_decode_iso_datetime(dtstr):
 DEFAULT = datetime.datetime.utcnow().replace(second=0, microsecond=0)
 dt = dateutil.parser.parse(dtstr, default=DEFAULT)
 if (dt.tzinfo is None):
  try:
   dt = dateutil.parser.parse((dtstr + ' +0000'), default=DEFAULT)
  except:
   dt = dateutil.parser.parse((dtstr + ' 00:00:00 +0000'), default=DEFAULT)
 return dt

def s3_decode_iso_datetime ( dtstr ) : DEFAULT = datetime . datetime . utcnow ( ) . replace ( second = 0 , microsecond = 0 ) dt = dateutil . parser . parse ( dtstr , default = DEFAULT ) if ( dt . tzinfo is None ) : try : dt = dateutil . parser . parse ( ( dtstr + ' +0000' ) , default = DEFAULT ) except : dt = dateutil . parser . parse ( ( dtstr + ' 00:00:00 +0000' ) , default = DEFAULT ) return dt
convert date/time string in iso-8601 format into a datetime object @note: this routine is named "iso" for consistency reasons .