This algorithm is the partner of take_match; see the documentation of that algorithm for further details.