code: def choi_matrix(pauli_tm, basis):
      
  
      if not basis.is_orthonormal():  # pragma no coverage
          raise ValueError("Need an orthonormal operator basis.")
      if not all((is_hermitian(op) for op in basis.ops)):  # pragma no coverage
          raise ValueError("Need an operator basis of hermitian operators.")
  
      sbasis = basis.super_basis()
      D = basis.dim
      choi = sum((pauli_tm[jj, kk] * sbasis.ops[jj + kk * D] for jj in range(D) for kk in range(D)))
      choi.superrep = CHOI
      return choi
docs: Compute the Choi matrix for a quantum process from its Pauli Transfer Matrix.
  
      This agrees with the definition in
      `Chow et al. <https://doi.org/10.1103/PhysRevLett.109.060501>`_
      except for a different overall normalization.
      Our normalization agrees with that of qutip.
  
      :param numpy.ndarray pauli_tm: The Pauli Transfer Matrix as 2d-array.
      :param OperatorBasis basis:  The operator basis, typically products of normalized Paulis.
      :return: The Choi matrix as qutip.Qobj.
      :rtype: qutip.Qobj