code: def build_qfunc(wires):
      def qfunc(x, y, z):
          qml.Hadamard(wires=wires[0])
          qml.RZ(z, wires=wires[2])
          qml.CNOT(wires=[wires[2], wires[1]])
          qml.CNOT(wires=[wires[1], wires[0]])
          qml.RX(x, wires=wires[0])
          qml.CNOT(wires=[wires[1], wires[0]])
          qml.RZ(-z, wires=wires[2])
          qml.RX(y, wires=wires[0])
          qml.PauliY(wires=wires[2])
          qml.CY(wires=[wires[1], wires[2]])
          return qml.expval(qml.PauliZ(wires=wires[0]))
  
      return qfunc
  
imports: from functools import partial
  import pytest
  from test_optimization.utils import compare_operation_lists
  import pennylane
  from pennylane import numpy
  from pennylane.wires import Wires
  from pennylane.transforms.compile import compile
  from pennylane.transforms import unitary_to_rot
  from pennylane.transforms.optimization import cancel_inverses, commute_controlled, merge_rotations, single_qubit_fusion
  from pennylane.transforms.optimization.optimization_utils import _fuse_global_phases
label_desc: Use image node_id 1 for calling a global function with example usage: build_qfunc(wires) and returns: qfunc, qml