code: def is_bool_indexer(key):
      # type: (Any) -> bool
      """
      Check whether `key` is a valid boolean indexer.
  
      Parameters
      ----------
      key : Any
          Only list-likes may be considered boolean indexers.
          All other types are not considered a boolean indexer.
          For array-like input, boolean ndarrays or ExtensionArrays
          with ``_is_boolean`` set are considered boolean indexers.
  
      Returns
      -------
      bool
  
      Raises
      ------
      ValueError
          When the array is an object-dtype ndarray or ExtensionArray
          and contains missing values.
      """
      na_msg = "cannot index with vector containing NA / NaN values"
      if isinstance(key, (ABCSeries, np.ndarray, ABCIndex)) or (
          is_array_like(key) and is_extension_array_dtype(key.dtype)
      ):
          if key.dtype == np.object_:
              key = np.asarray(values_from_object(key))
  
              if not lib.is_bool_array(key):
                  if isna(key).any():
                      raise ValueError(na_msg)
                  return False
              return True
          elif is_bool_dtype(key.dtype):
              # an ndarray with bool-dtype by definition has no missing values.
              # So we only need to check for NAs in ExtensionArrays
              if is_extension_array_dtype(key.dtype):
                  if np.any(key.isna()):
                      raise ValueError(na_msg)
              return True
      elif isinstance(key, list):
          try:
              arr = np.asarray(key)
              return arr.dtype == np.bool_ and len(arr) == len(key)
          except TypeError:  # pragma: no cover
              return False
  
      return False
  
imports: import collections
  from datetime import datetime, timedelta
  from functools import partial
  import inspect
  import numpy
  from pandas._libs import lib, tslibs
  import pandas.compat
  from pandas.compat import PY36, OrderedDict, iteritems
  from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
  from pandas.core.dtypes.common import is_array_like, is_bool_dtype, is_extension_array_dtype, is_integer
  from pandas.core.dtypes.generic import ABCIndex, ABCIndexClass, ABCSeries
  from pandas.core.dtypes.inference import _iterable_not_string
  from pandas.core.dtypes.missing import isna, isnull, notnull
label_desc: Use image node_id 5 for calling a global function with example usage: is_bool_indexer(key) and returns: False, True, False, True, unknown, False