def check_neighbor(self, input_ex: Example, neighbor_ex: Example,
                     state: Any) -> bool:
    """Returns whether the neighbor is usable."""
    if input_ex["hashed_id"] == neighbor_ex["hashed_id"]:
      return False
    key = self._example_to_crowding_key(neighbor_ex)
    return state is None or state.get(key, 0) < self._max_per_crowding_key
Returns whether the neighbor is usable.
language/casper/retrieve/query_retrievers.py