def check_setitem_lengths(indexer, value, values):
<EOL>if isinstance(indexer, (np.ndarray, list)):<EOL><INDENT>if is_list_like(value) and len(indexer) != len(value):<EOL><INDENT>if not (isinstance(indexer, np.ndarray) and<EOL>indexer.dtype == np.bool_ and<EOL>len(indexer[indexer]) == len(value)):<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT>elif isinstance(indexer, slice):<EOL><INDENT>if is_list_like(value) and len(values):<EOL><INDENT>if len(value) != length_of_indexer(indexer, values):<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT>
Validate that value and indexer are the same length.

An special-case is allowed for when the indexer is a boolean array
and the number of true values equals the length of ``value``. In
this case, no exception is raised.

Parameters
----------
indexer : sequence
    The key for the setitem
value : array-like
    The value for the setitem
values : array-like
    The values being set into

Returns
-------
None

Raises
------
ValueError
    When the indexer is an ndarray or list and the lengths don't
    match.