docs: def _unitary_(self) -> Union[np.ndarray, NotImplementedType]:
          """Converts the circuit into a unitary matrix, if possible.
  
          If the circuit contains any non-terminal measurements, the conversion
          into a unitary matrix fails (i.e. returns NotImplemented). Terminal
          measurements are ignored when computing the unitary matrix. The unitary
          matrix is the product of the unitary matrix of all operations in the
          circuit (after expanding them to apply to the whole system).
          """
          if not self._has_unitary_():
              return NotImplemented
          return self.to_unitary_matrix(ignore_terminal_measurements=True)