code: def _check_index_map(index_map):
      if index_map is None:
          return
  
      if not isinstance(index_map, dict):
          raise TypeError(
              "Input `index_map` must be a dict mapping target label to prediction-vector index."
          )
  
      indices = [v for k, v in index_map.items()]
      indices.sort()
      if indices != list(range(len(index_map))):
          raise _ToolkitError(
              "Invalid index_map: each target label must map to a distinct index into the prediction vector."
          )
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import turicreate
  from turicreate.toolkits._internal_utils import _raise_error_if_not_sarray, _check_categorical_option_type
  from turicreate.toolkits._main import ToolkitError
label_desc: Use image node_id 5 for calling a global function with example usage: _check_index_map(index_map) without return types