code: def almost_unitary(gate: Gate) -> bool:
      
      res = (gate @ gate.H).asoperator()
      N = gate.qubit_nb
      return np.allclose(asarray(res), np.eye(2**N), atol=TOLERANCE)
docs: Return true if gate tensor is (almost) unitary