<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def state_fidelity(state0: State, state1: State) -> bk.BKTensor: """Return the quantum fidelity between pure states."""

    assert state0.qubits == state1.qubits   # FIXME
    tensor = bk.absolute(bk.inner(state0.tensor, state1.tensor))**bk.fcast(2)
    return tensor