<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def flatten(self) -> bk.BKTensor: """Return tensor with with qubit indices flattened"""

        N = self.qubit_nb
        R = self.rank
        return bk.reshape(self.tensor, [2**N]*R)