code: def _run_assertions(
      U, expected_gates, expected_params, obtained_gates
  ):
      """Runs assertions for unitary decomposition transforms."""
  
      assert len(obtained_gates) == len(
          expected_gates
      ), "Incorrect number of gates"
  
      for i, gate in enumerate(obtained_gates):
          # Check type of gate
          assert isinstance(
              gate, expected_gates[i]
          ), "Incorrect type of gate"
  
          # Check the wire that the gates act on
          if not isinstance(gate, qml.GlobalPhase):
              assert gate.wires == Wires("a"), "Incorrect wire"
  
          # Check gate parameters
          assert qml.math.allclose(
              qml.math.unwrap(gate.parameters),
              expected_params[i],
              atol=1e-7,
          ), "Incorrect gate parameters"
  
      obtained_mat = reduce(
          np.matmul,
          [
              op.matrix(wire_order=["a"])
              for op in reversed(obtained_gates)
          ],
      )
  
      if len(obtained_mat.shape) == 2:
          U = [U]
          obtained_mat = [obtained_mat]
  
      assert all(
          check_matrix_equivalence(curr_obtained_mat, curr_U, atol=1e-7)
          for curr_obtained_mat, curr_U in zip(
              obtained_mat, qml.math.unwrap(U)
          )
      )
  
imports: from functools import reduce
  import pytest
  from gate_data import I, Z, S, T, H, X, Y, CNOT, SWAP
  import pennylane
  from pennylane import numpy
  from pennylane.wires import Wires
  from pennylane.ops.op_math.decompositions import one_qubit_decomposition
  from pennylane.ops.op_math.decompositions import two_qubit_decomposition
  from pennylane.ops.op_math.decompositions.two_qubit_unitary import _convert_to_su4, _su2su2_to_tensor_products, _compute_num_cnots
label_desc: Use image node_id 2 for calling a global function with example usage: _run_assertions(U, expected_gates, expected_params, obtained_gates) without return types