def s3_encode_iso_datetime(dt):
 if isinstance(dt, (datetime.datetime, datetime.time)):
  dx = dt.replace(microsecond=0)
 else:
  dx = dt
 return dx.isoformat()

def s3_encode_iso_datetime ( dt ) : if isinstance ( dt , ( datetime . datetime , datetime . time ) ) : dx = dt . replace ( microsecond = 0 ) else : dx = dt return dx . isoformat ( )
convert a datetime object into a iso-8601 formatted string .