code: def _determine_key_type(key):
      """Determine the data type of key"""
      err_msg = (
          "No valid specification of the columns. Only a scalar, list or "
          "slice of all integers or all strings, or boolean mask is "
          "allowed"
      )
  
      dtype_to_str = {
          int: "int",
          str: "str",
          bool: "bool",
          np.bool_: "bool",
      }
      array_dtype_to_str = {
          "i": "int",
          "u": "int",
          "b": "bool",
          "O": "str",
          "U": "str",
          "S": "str",
      }
  
      if key is None:
          return None
      if isinstance(key, tuple(dtype_to_str.keys())):
          try:
              return dtype_to_str[type(key)]
          except KeyError:
              raise ValueError(err_msg)
      if isinstance(key, slice):
          if key.start is None and key.stop is None:
              return None
          key_start_type = _determine_key_type(key.start)
          key_stop_type = _determine_key_type(key.stop)
          if key_start_type is not None and key_stop_type is not None:
              if key_start_type != key_stop_type:
                  raise ValueError(err_msg)
          if key_start_type is not None:
              return key_start_type
          return key_stop_type
      if isinstance(key, list):
          unique_key = set(key)
          key_type = {_determine_key_type(elt) for elt in unique_key}
          if not key_type:
              return None
          if len(key_type) != 1:
              raise ValueError(err_msg)
          return key_type.pop()
      if hasattr(key, "dtype"):
          try:
              return array_dtype_to_str[key.dtype.kind]
          except KeyError:
              raise ValueError(err_msg)
      raise ValueError(err_msg)
  
imports: import numbers
  import numpy
  from itertools import compress
  from scipy.sparse import issparse
  from sklearn.model_selection import ParameterGrid
  from sklearn.utils.validation import check_is_fitted
label_desc: Use image node_id 12 for calling a global function with example usage: _determine_key_type(key) and returns: None, key_stop_type, key_type, dtype_to_str, None, key_start_type, None, array_dtype_to_str