code: def function_expand_helper(
      node: NodeProto, function_proto: FunctionProto, op_prefix: str
  ) -> List[NodeProto]:
      io_names_map = {}
      attribute_map = {a.name: a for a in node.attribute}
  
      for idx in range(len(function_proto.input)):
          io_names_map[function_proto.input[idx]] = (
              node.input[idx] if idx in range(len(node.input)) else ""
          )
  
      for idx in range(len(function_proto.output)):
          # Even if the node has been created with optional outputs missing, we
          # can't assume that the function body handles this correctly, such as in
          # the case that output is also an intermediate value.
          # So we only add a name mapping if the output is present. An internal
          # name will be generated if the missing output is used, the same as any
          # other internal tensor.
          if idx in range(len(node.output)) and node.output[idx] != "":
              io_names_map[function_proto.output[idx]] = node.output[
                  idx
              ]
  
      def rename_helper(internal_name: str) -> Any:
          if internal_name in io_names_map:
              return io_names_map[internal_name]
          elif internal_name == "":
              return ""
          return op_prefix + internal_name
  
      new_node_list = [
          _rename_edges_helper(
              internal_node, rename_helper, attribute_map, op_prefix
          )
          for internal_node in function_proto.node
      ]
      return new_node_list
  
file_path: onnx/onnx/backend/test/case/node/__init__.py
imports: import subprocess
  import sys
  from copy import deepcopy
  from pathlib import Path
  from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
  import numpy
  import onnx
  from onnx.backend.test.case.test_case import TestCase
  from onnx.backend.test.case.utils import import_recursive
  from onnx.onnx_pb import AttributeProto, FunctionProto, GraphProto, ModelProto, NodeProto, TensorProto, TypeProto
label_desc: Use image node_id 2 for calling a global function with example usage: function_expand_helper(node, function_proto, op_prefix) and returns: new_node_list, unknown, io_names_map, str