def is_bool_indexer(key: Any) -> bool:
na_msg = '<STR_LIT>'<EOL>if (isinstance(key, (ABCSeries, np.ndarray, ABCIndex)) or<EOL>(is_array_like(key) and is_extension_array_dtype(key.dtype))):<EOL><INDENT>if key.dtype == np.object_:<EOL><INDENT>key = np.asarray(values_from_object(key))<EOL>if not lib.is_bool_array(key):<EOL><INDENT>if isna(key).any():<EOL><INDENT>raise ValueError(na_msg)<EOL><DEDENT>return False<EOL><DEDENT>return True<EOL><DEDENT>elif is_bool_dtype(key.dtype):<EOL><INDENT>if is_extension_array_dtype(key.dtype):<EOL><INDENT>if np.any(key.isna()):<EOL><INDENT>raise ValueError(na_msg)<EOL><DEDENT><DEDENT>return True<EOL><DEDENT><DEDENT>elif isinstance(key, list):<EOL><INDENT>try:<EOL><INDENT>arr = np.asarray(key)<EOL>return arr.dtype == np.bool_ and len(arr) == len(key)<EOL><DEDENT>except TypeError:  <EOL><INDENT>return False<EOL><DEDENT><DEDENT>return False<EOL>
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.