code: def unpack_kraus_matrix(m):
          
          m = np.asarray(m, dtype=complex)
          if m.ndim == 3:
              m = m[0] + 1j * m[1]
          if not m.ndim == 2:  # pragma no coverage
              raise ValueError("Need 2d array.")
          if not m.shape[0] == m.shape[1]:  # pragma no coverage
              raise ValueError("Need square matrix.")
          return m
docs: Helper to optionally unpack a JSON compatible representation of a complex Kraus matrix.
  
          :param Union[list,np.array] m: The representation of a Kraus operator. Either a complex
              square matrix (as numpy array or nested lists) or a JSON-able pair of real matrices
              (as nested lists) representing the element-wise real and imaginary part of m.
          :return: A complex square numpy array representing the Kraus operator.
          :rtype: np.array