code: def measure_all(self, *qubit_reg_pairs):
          
          if qubit_reg_pairs == ():
              qubit_inds = self.get_qubits(indices=True)
              if len(qubit_inds) == 0:
                  return self
              ro = self.declare('ro', 'BIT', max(qubit_inds) + 1)
              for qi in qubit_inds:
                  self.inst(MEASURE(qi, ro[qi]))
          else:
              for qubit_index, classical_reg in qubit_reg_pairs:
                  self.inst(MEASURE(qubit_index, classical_reg))
          return self
docs: Measures many qubits into their specified classical bits, in the order
          they were entered. If no qubit/register pairs are provided, measure all qubits present in
          the program into classical addresses of the same index.
  
          :param Tuple qubit_reg_pairs: Tuples of qubit indices paired with classical bits.
          :return: The Quil Program with the appropriate measure instructions appended, e.g.
  
          .. code::
  
                    MEASURE 0 [1]
                    MEASURE 1 [2]
                    MEASURE 2 [3]
  
          :rtype: Program