code: def indices_up_to_dm(n_max):
      """Returns an iterator over the number of qubits and output dimension, up to value n_max.
      The output dimension values never exceeds 2 ** (n_max). This is to test for density_matrix
      qnodes."""
  
      # If the output_dim is to be used as a tuple. First element is for n_qubits and
      # the second is for output_dim. For example, for n_max = 3 it will return,
      # [(1, (2, 2)), (2, (2, 2)), (2, (4, 4)), (3, (2, 2)), (3, (4, 4)), (3, (8, 8))]
  
      a, b = np.tril_indices(n_max)
      return zip(*[a + 1], zip(*[2 ** (b + 1), 2 ** (b + 1)]))
  
imports: from collections import defaultdict
  import numpy
  import pytest
  import pennylane
label_desc: Use image node_id 4 for calling a global function with example usage: indices_up_to_dm(n_max) and returns: zip