code: def generalized_pair_doubles(wires):
      r"""Return pair coupled-cluster double excitations
  
      .. math::
          \hat{T_2} = \sum_{pq} t_{p_\alpha p_\beta}^{q_\alpha, q_\beta}
                 \hat{c}^{\dagger}_{q_\alpha} \hat{c}^{\dagger}_{q_\beta} \hat{c}_{p_\beta} \hat{c}_{p_\alpha}
  
      """
      pair_gen_doubles_wires = [
          [
              wires[r : r + 2],
              wires[p : p + 2],
          ]  # wires for [wires[r], wires[r+1], wires[p], wires[p+1]] terms
          for r in range(0, len(wires) - 1, 2)
          for p in range(0, len(wires) - 1, 2)
          if p != r  # remove redundant terms
      ]
      return pair_gen_doubles_wires
  
file_path: pennylane/pennylane/templates/subroutines/kupccgsd.py
imports: import numpy
  import pennylane
  from pennylane.operation import Operation, AnyWires
label_desc: Use image node_id 2 for calling a global function with example usage: generalized_pair_doubles(wires) and returns: pair_gen_doubles_wires