code: def subtype_ids(elements, subtype):
      
      return [i for (i, element) in enumerate(elements)
              if isinstance(element, subtype)]
docs: returns the ids of all elements of a list that have a certain type,
      e.g. show all the nodes that are ``TokenNode``\s.