def _iter_code(code):

    """Yield '(op,arg)' pair for each operation in code object 'code'"""

    from array import array
    from dis import HAVE_ARGUMENT, EXTENDED_ARG

    bytes = array('b',code.co_code)
    eof = len(code.co_code)

    ptr = 0
    extended_arg = 0

    while ptr<eof:

        op = bytes[ptr]

        if op>=HAVE_ARGUMENT:

            arg = bytes[ptr+1] + bytes[ptr+2]*256 + extended_arg
            ptr += 3

            if op==EXTENDED_ARG:
                extended_arg = arg * compat.long_type(65536)
                continue

        else:
            arg = None
            ptr += 1

        yield op,arg
Yield '(op,arg)' pair for each operation in code object 'code