def at_keypaths(self, keypaths: Collection[KeyPath]) -> "Selection":
    """Selects nodes by their keypaths (relative to the current selection).

    Args:
      keypaths: A collection of keypaths.

    Returns:
      A new selection where any node whose keypath is in the given selection
      is selected. Note that if any path in ``keypaths`` is a prefix of another,
      only the shorter prefix will be used, since selected nodes cannot be
      nested.
    """
    return self.at_subtrees_where(
        lambda keypath, _: keypath in keypaths,
        with_keypath=True,
        absolute_keypath=False,
    )
Selects nodes by their keypaths (relative to the current selection).

    Args:
      keypaths: A collection of keypaths.

    Returns:
      A new selection where any node whose keypath is in the given selection
      is selected. Note that if any path in ``keypaths`` is a prefix of another,
      only the shorter prefix will be used, since selected nodes cannot be
      nested.
    
penzai/core/selectors.py