code: def _gen_input_casting_func(
      sig: dict[str, t.Any]
  ) -> ONNXArgCastingFuncType:
      input_types = list(sig.keys())
      if len(input_types) != 1:
          raise BentoMLException(
              "onnx model input type dictionary should have only one key!"
          )
      input_type = input_types[0]
      input_spec = sig[input_type]
      return CASTING_FUNC_DISPATCHER[input_type](input_spec)
  
file_path: BentoML/src/bentoml/_internal/frameworks/utils/onnx.py
imports: from __future__ import annotations
  import logging
  import typing
  from typing import TYPE_CHECKING
  from ....exceptions import BentoMLException
  from ...types import LazyType
  from ...utils.lazy_loader import LazyLoader
label_desc: Use image node_id 2 for calling a global function with example usage: _gen_input_casting_func(sig) and returns: CASTING_FUNC_DISPATCHER