def _node_types_match(node, node_template):
    """
    Verifies whether input and output types of two nodes match. The first has fixed arities of
    the input type whereas the second is a template with variable arities.

    :param node: Node with fixed input types arities.
    :param node_template: A node template with variable arities.

    :return bool: True if the types of the nodes match.
    """
    if node.node_type[1] != node_template.out_type:
        return False
    in_types = node.node_type[0]
    template_types = node_template.type_arities
    if len(in_types) != len(template_types):
        return False
    for in_type_1, in_type_2 in zip(in_types, template_types):
        if in_type_1.name != in_type_2.prim_type:
            return False
        if not in_type_2.is_valid_arity(in_type_1.arity):
            return False
    return True
