returns the ids of all elements of a list that have a certain type,
    e.g. show all the nodes that are ``TokenNode``\s.

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