def at_instances_of(
      self,
      cls: type[OtherSubtree] | tuple[type[OtherSubtree], ...],
      innermost: bool = False,
  ) -> "Selection[OtherSubtree]":
    """Selects subtrees that are an instance of the given type.

    Convenience wrapper for::

      .at_subtrees_where(lambda subtree: isinstance(subtree, cls))

    Args:
      cls: The class (or tuple of classes) to retrieve instances of.
      innermost: Whether to return the innermost instances of the class (instead
        of the outermost).

    Returns:
      A refined selection that selects instances of this class within the
      original selection. If instances of this class are nested, only selects
      the outermost (if ``innermost=False``) or the innermost (if
      ``innermost=True``), but never both.
    """
    return self.at_subtrees_where(
        lambda subtree: isinstance(subtree, cls), innermost=innermost
    )
Selects subtrees that are an instance of the given type.

    Convenience wrapper for::

      .at_subtrees_where(lambda subtree: isinstance(subtree, cls))

    Args:
      cls: The class (or tuple of classes) to retrieve instances of.
      innermost: Whether to return the innermost instances of the class (instead
        of the outermost).

    Returns:
      A refined selection that selects instances of this class within the
      original selection. If instances of this class are nested, only selects
      the outermost (if ``innermost=False``) or the innermost (if
      ``innermost=True``), but never both.
    
penzai/core/selectors.py