<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _validate_num_qubits(state: np.ndarray) -> int: """Validates that state's size is a power of 2, returning number of qubits. """

    size = state.size
    if size & (size - 1):
        raise ValueError('state.size ({}) is not a power of two.'.format(size))
    return size.bit_length() - 1