Find the nodes of a given instance.

    In contract to the standard ``template.nodelist.get_nodes_by_type()`` method,
    this also looks into ``{% extends %}`` and ``{% include .. %}`` nodes
    to find all possible nodes of the given type.

    :param instances: A class Type, or tuple of types to find.
    :param nodelist:  The Template object, or nodelist to scan.
    :returns: A list of Node objects which inherit from the list of given `instances` to find.
    :rtype: list

def get_node_instances(nodelist, instances):
    """
    Find the nodes of a given instance.

    In contract to the standard ``template.nodelist.get_nodes_by_type()`` method,
    this also looks into ``{% extends %}`` and ``{% include .. %}`` nodes
    to find all possible nodes of the given type.

    :param instances: A class Type, or tuple of types to find.
    :param nodelist:  The Template object, or nodelist to scan.
    :returns: A list of Node objects which inherit from the list of given `instances` to find.
    :rtype: list
    """
    context = _get_main_context(nodelist)

    # The Django 1.8 loader returns an adapter class; it wraps the original Template in a new object to be API compatible
    if TemplateAdapter is not None and isinstance(nodelist, TemplateAdapter):
        nodelist = nodelist.template

    return _scan_nodes(nodelist, context, instances)