'Return the mapping as an iterable of ((code1, code2), state_set) and
(special_event, state_set) pairs.'

def iteritems(self, len=len):

    result = []
    map = self.map
    else_set = map[1]
    i = 0
    n = (len(map) - 1)
    code0 = map[0]
    while (i < n):
        set = map[(i + 1)]
        code1 = map[(i + 2)]
        if (set or else_set):
            result.append(((code0, code1), set))
        code0 = code1
        i += 2
    for (event, set) in self.special.items():
        if set:
            result.append((event, set))
    return iter(result)
