def _GetDescendants(self, tokens, name, do_not_cross=()):
    """Find all descendants in the tree with a given name.

    Args:
      tokens: Tree root node
      name: Token name to find
      do_not_cross: A list of token names to not recurse past

    Returns:
      A list of tokens of the given name.
    """
    matches = []
    for token in tokens:
      if isinstance(token, pyp.ParseResults):
        logging.debug('GetDescendants: checking %s', token.getName())
        if token.getName() == name:
          matches.append(token)
        if token.getName() in do_not_cross:
          logging.debug('GetDescendants: skipping %s', token.getName())
        else:
          matches.extend(self._GetDescendants(token, name, do_not_cross))
    return matches
dataset/ETHPy150Open google/mysql-tools/parser_lib/validator.py/Visitor._GetDescendants/original