'Find the first <instr> in the block from start to end.
<instr> is any python bytecode instruction or a list of opcodes
If <instr> is an opcode with a target (like a jump), a target
destination can be specified which must match precisely if exact
is True, or if exact is False, the instruction which has a target
closest to <target> will be returned.
Return index to it or None if not found.'

def first_instr(self, start, end, instr, target=None, exact=True):

    code = self.code
    assert ((start >= 0) and (end <= len(code)))
    try:
        (None in instr)
    except:
        instr = [instr]
    pos = None
    distance = len(code)
    for i in self.op_range(start, end):
        op = code[i]
        if (op in instr):
            if (target is None):
                return i
            dest = self.get_target(i, op)
            if (dest == target):
                return i
            elif (not exact):
                _distance = abs((target - dest))
                if (_distance < distance):
                    distance = _distance
                    pos = i
    return pos
