@staticmethod
def loop(ctx, node, output_str):
    loop_outputs = output_str
    loop_vars = node.node_config('initial_loop_vars')
    loop_vars_str = ctx.infer_attr_value((loop_vars[0] if (len(loop_vars) == 1) else loop_vars))
    assert (len(loop_vars) == len(ctx._get_module_output(node)))
    init_condition_str = ctx.infer_attr_value(node.node_config('initial_condition'))
    body_str = ''
    block_inputs_idx = 0
    iter_var_str = ''
    block_inputs = []
    iter_start_str = str(0)
    max_trip_count = node.node_config('max_trip_count')
    max_trip_count_str = ctx.infer_attr_value(max_trip_count)
    for inner_node in node.blocks[0].nodes:
        if (inner_node.op.type == NNDCT_OP.INPUT):
            output_str = ctx._to_list_str(ctx._get_module_output(inner_node))
            if (block_inputs_idx == 0):
                iter_var_str = output_str
            else:
                if (isinstance(ctx._get_module_output(inner_node), list) and (len(ctx._get_module_output(inner_node)) > 1)):
                    output_str = f'({output_str})'
                block_inputs.append(output_str)
            block_inputs_idx += 1
        elif (inner_node.op.type == NNDCT_OP.DERIVE_LOOP_INDEX):
            iter_start_str = str(inner_node.node_config('start'))
            output_str = ctx._to_list_str(ctx._get_module_output(inner_node))
            iter_var_str = output_str
        else:
            (forward_str, output_str) = ctx._get_forward_str(inner_node)
            body_str += (forward_str + '\n')
    block_inputs_str = ','.join(block_inputs)
    body_ret_str = ','.join([ctx.infer_attr_value(ret_val) for ret_val in node.blocks[0].return_struct[1:]])
    iter_end_str = '+'.join([max_trip_count_str, iter_start_str])
    iter_conditon_str = ctx.infer_attr_value(node.blocks[0].return_struct[0])
    loop_pattern = None
    if node.node_config('is_while_loop'):
        loop_pattern = CodeTemplate('$loop_outputs = $loop_vars\ncondition = $initial_condition\nwhile condition:\n    $block_inputs = $loop_outputs\n    $body\n    $loop_outputs = $body_ret\n    condition = $iter_condition\n      ')
        return loop_pattern.substitute(loop_outputs=loop_outputs, loop_vars=loop_vars_str, initial_condition=init_condition_str, block_inputs=block_inputs_str, body=body_str, body_ret=body_ret_str, iter_condition=iter_conditon_str)
    else:
        loop_pattern = CodeTemplate('$loop_outputs = $loop_vars\nfor $iter_var in range($iter_start, $iter_end):\n    $block_inputs = $loop_outputs\n    $body\n    $loop_outputs = $body_ret\n  ')
        return loop_pattern.substitute(loop_outputs=loop_outputs, loop_vars=loop_vars_str, iter_var=iter_var_str, iter_start=iter_start_str, iter_end=iter_end_str, block_inputs=block_inputs_str, body=body_str, body_ret=body_ret_str)
@staticmethod
def loop(ctx, node, output_str):
    loop_outputs = output_str
    loop_vars = node.node_config('initial_loop_vars')
    loop_vars_str = ctx.infer_attr_value((loop_vars[0] if (len(loop_vars) == 1) else loop_vars))
    assert (len(loop_vars) == len(ctx._get_module_output(node)))
    init_condition_str = ctx.infer_attr_value(node.node_config('initial_condition'))
    body_str = 
    block_inputs_idx = 0
    iter_var_str = 
    block_inputs = []
    iter_start_str = str(0)
    max_trip_count = node.node_config('max_trip_count')
    max_trip_count_str = ctx.infer_attr_value(max_trip_count)
    for inner_node in node.blocks[0].nodes:
        if (inner_node.op.type == NNDCT_OP.INPUT):
            output_str = ctx._to_list_str(ctx._get_module_output(inner_node))
            if (block_inputs_idx == 0):
                iter_var_str = output_str
            else:
                if (isinstance(ctx._get_module_output(inner_node), list) and (len(ctx._get_module_output(inner_node)) > 1)):
                    output_str = f'({output_str})'
                block_inputs.append(output_str)
            block_inputs_idx += 1
        elif (inner_node.op.type == NNDCT_OP.DERIVE_LOOP_INDEX):
            iter_start_str = str(inner_node.node_config('start'))
            output_str = ctx._to_list_str(ctx._get_module_output(inner_node))
            iter_var_str = output_str
        else:
            (forward_str, output_str) = ctx._get_forward_str(inner_node)
            body_str += (forward_str + '\n')
    block_inputs_str = ','.join(block_inputs)
    body_ret_str = ','.join([ctx.infer_attr_value(ret_val) for ret_val in node.blocks[0].return_struct[1:]])
    iter_end_str = '+'.join([max_trip_count_str, iter_start_str])
    iter_conditon_str = ctx.infer_attr_value(node.blocks[0].return_struct[0])
    loop_pattern = None
    if node.node_config('is_while_loop'):
        loop_pattern = CodeTemplate('$loop_outputs = $loop_vars\ncondition = $initial_condition\nwhile condition:\n    $block_inputs = $loop_outputs\n    $body\n    $loop_outputs = $body_ret\n    condition = $iter_condition\n      ')
        return loop_pattern.substitute(loop_outputs=loop_outputs, loop_vars=loop_vars_str, initial_condition=init_condition_str, block_inputs=block_inputs_str, body=body_str, body_ret=body_ret_str, iter_condition=iter_conditon_str)
    else:
        loop_pattern = CodeTemplate('$loop_outputs = $loop_vars\nfor $iter_var in range($iter_start, $iter_end):\n    $block_inputs = $loop_outputs\n    $body\n    $loop_outputs = $body_ret\n  ')
        return loop_pattern.substitute(loop_outputs=loop_outputs, loop_vars=loop_vars_str, iter_var=iter_var_str, iter_start=iter_start_str, iter_end=iter_end_str, block_inputs=block_inputs_str, body=body_str, body_ret=body_ret_str)