code: def get_index_dtype(arrays=(), maxval=None, check_contents=False):
      """
      Based on input (integer) arrays `a`, determine a suitable index data
      type that can hold the data in the arrays.
  
      Parameters
      ----------
      arrays : tuple of array_like
          Input arrays whose types/contents to check
      maxval : float, optional
          Maximum value needed
      check_contents : bool, optional
          Whether to check the values in the arrays and not just their types.
          Default: False (check only the types)
  
      Returns
      -------
      dtype : dtype
          Suitable index data type (int32 or int64)
  
      """
  
      int32min = np.iinfo(np.int32).min
      int32max = np.iinfo(np.int32).max
  
      dtype = np.intc
      if maxval is not None:
          if maxval > int32max:
              dtype = np.int64
  
      if isinstance(arrays, np.ndarray):
          arrays = (arrays,)
  
      for arr in arrays:
          arr = np.asarray(arr)
          if not np.can_cast(arr.dtype, np.int32):
              if check_contents:
                  if arr.size == 0:
                      # a bigger type not needed
                      continue
                  elif np.issubdtype(arr.dtype, np.integer):
                      maxval = arr.max()
                      minval = arr.min()
                      if minval >= int32min and maxval <= int32max:
                          # a bigger type not needed
                          continue
  
              dtype = np.int64
              break
  
      return dtype
  
imports: from __future__ import division, print_function, absolute_import
  import operator
  import warnings
  import numpy
  from scipy._lib._version import NumpyVersion
label_desc: Use image node_id 7 for calling a global function with example usage: get_index_dtype(arrays, maxval, check_contents) and returns: dtype