'Find the final replacement instruction for a given initial
instruction by chasing instructions in a map from instructions
to replacement instructions.'

def _get_final_replacement(self, replacement_map, instr):

    replacement = replacement_map[instr]
    while (replacement in replacement_map):
        replacement = replacement_map[replacement]
    return replacement
