code: def _sanitize_block_input_vars(
      block,
      sanitizer_vars,
      main_input_types,
      sanitize_main_input_only=False,
  ):
      # iterate over all the block input vars and sanitize the names
      if isinstance(block, Function):
          # this is the "main" block
          # block.inputs is a dict from input names to input vars
          # iterate over the input vars of the main program and sanitize their names
          new_input_dict = OrderedDict()
          input_name_updated = False
          for input_name, var in block.inputs.items():
              msg = "Main block's input name, '{}', is different from its corresponding var's name, '{}'."
              assert input_name == var.name, msg.format(
                  input_name, var.name
              )
              new_name = sanitizer_vars.sanitize_name(var.name)
              new_input_dict[new_name] = var
              if new_name != var.name:
                  msg = "Input, '{}', of the source model, has been renamed to '{}' in the Core ML model."
                  warnings.warn(msg.format(var.name, new_name))
                  if var.name in block.placeholder_inputs:
                      block.placeholder_inputs[
                          new_name
                      ] = block.placeholder_inputs.pop(var.name)
                      block.placeholder_inputs[new_name].set_name(
                          new_name
                      )
                  var.set_name(new_name)
                  input_name_updated = True
                  if main_input_types is not None:
                      # update prog's main_input_types, since we are updating the name of a model input here
                      for i in range(len(main_input_types)):
                          if main_input_types[i].name == input_name:
                              main_input_types[i].name = new_name
                              break
          if input_name_updated:
              block._input_dict = new_input_dict
      elif not sanitize_main_input_only:
          # in this case block is not the "main" function
          # in this case block.inputs is a list of input vars of the block
          for var in block.inputs:
              new_name = sanitizer_vars.sanitize_name(var.name)
              if new_name != var.name:
                  var.set_name(new_name)
  
imports: import re
  import warnings
  from collections import OrderedDict
  from coremltools import _logger
  from coremltools.converters.mil.input_types import EnumeratedShapes, ImageType, Shape
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Function, types
  from coremltools.converters.mil.mil.passes.graph_pass import AbstractGraphPass
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
label_desc: Use image node_id 5 for calling the NameSanitizer obj's underlying member method code with example usage: obj._sanitize_block_input_vars(block, sanitizer_vars, main_input_types, sanitize_main_input_only) without return types