def gen_dx_nodes(dx_nodes, *dx_types):
    """
    Generator for dx_nodes of a certain type.


    :param dx_nodes: [DiffxNode, DiffxNode, ...]
    """
    _append = []
    for _dx_node in dx_nodes:
        if isinstance(_dx_node.type, dx_types):
            _append.append((len(dx_nodes) - _dx_node.child_cnt, _dx_node.
                xpath, _dx_node))
    for _, _, _dx_node in sorted(_append):
        if isinstance(_dx_node.type, dx_types):
            yield _dx_node
