def scan(self, selector_fn: Callable[[str], bool]):
    """Retrieve memories that match the selector function.

    Args:
      selector_fn: a function that takes a string and returns a boolean
        indicating whether the string matches the selector

    Returns:
      List of strings corresponding to memories, sorted by recency
    """
    with self._memory_bank_lock:
      if self._memory_bank.empty:
        return []
      is_selected = self._memory_bank['text'].apply(selector_fn)
      data = self._memory_bank[is_selected]
    return self._pd_to_text(data)
Retrieve memories that match the selector function.

    Args:
      selector_fn: a function that takes a string and returns a boolean
        indicating whether the string matches the selector

    Returns:
      List of strings corresponding to memories, sorted by recency
    
concordia/associative_memory/basic_associative_memory.py