code: def check_api_dict(d):
      """Check that an api dict is valid (does not use the same index twice)."""
      # remove the extra value fields that aren't the index
      index_d = {k: v[0] for k, v in d.items()}
  
      # We have if a same index is used twice: we 'revert' the dict so that index
      # become keys. If the length is different, it means one index has been used
      # at least twice
      revert_dict = {v: k for k, v in index_d.items()}
      if not len(revert_dict) == len(index_d):
          # We compute a dict index -> list of associated items
          doubled = {}
          for name, index in index_d.items():
              try:
                  doubled[index].append(name)
              except KeyError:
                  doubled[index] = [name]
          fmt = "Same index has been used twice in api definition: {}"
          val = "".join(
              "\n\tindex {} -> {}".format(index, names)
              for index, names in doubled.items()
              if len(names) != 1
          )
          raise ValueError(fmt.format(val))
  
      # No 'hole' in the indexes may be allowed, and it must starts at 0
      indexes = set(index_d.values())
      expected = set(range(len(indexes)))
      if indexes != expected:
          diff = expected.symmetric_difference(indexes)
          msg = (
              "There are some holes in the API indexing: "
              "(symmetric diff is %s)" % diff
          )
          raise ValueError(msg)
  
imports: import hashlib
  import io
  import os
  import re
  import sys
  import importlib.util
  import textwrap
  from os.path import join
label_desc: Use image node_id 12 for calling a global function with example usage: check_api_dict(d) without return types