'Return sequence of (index, key, value, control_index)
of totally ordered pairs suitable for urlencoding.
control_index is the index of the control in self.controls'

def _pairs_and_controls(self):

    pairs = []
    for control_index in xrange(len(self.controls)):
        control = self.controls[control_index]
        for (ii, key, val) in control._totally_ordered_pairs():
            pairs.append((ii, key, val, control_index))
    pairs.sort()
    return pairs
