def to_spmatrix(self):
mat = sparse.coo_matrix(<NUM_LIT:1>)<EOL>for z, x in zip(self._z, self._x):<EOL><INDENT>if not z and not x:  <EOL><INDENT>mat = sparse.bmat([[mat, None], [None, mat]], format='<STR_LIT>')<EOL><DEDENT>elif z and not x:  <EOL><INDENT>mat = sparse.bmat([[mat, None], [None, -mat]], format='<STR_LIT>')<EOL><DEDENT>elif not z and x:  <EOL><INDENT>mat = sparse.bmat([[None, mat], [mat, None]], format='<STR_LIT>')<EOL><DEDENT>else:  <EOL><INDENT>mat = mat * <NUM_LIT><EOL>mat = sparse.bmat([[None, -mat], [mat, None]], format='<STR_LIT>')<EOL><DEDENT><DEDENT>return mat.tocsr()<EOL>
r"""
        Convert Pauli to a sparse matrix representation (CSR format).

        Order is q_{n-1} .... q_0, i.e., $P_{n-1} \otimes ... P_0$

        Returns:
            scipy.sparse.csr_matrix: a sparse matrix with CSR format that
            represnets the pauli.