@staticmethod
  def get_last_import_ref(bytecode, code_object):
    """
      Find the last reference of an import statement in the bytecode.
    """
    i, length = 0, len(bytecode)
    last_index = -1
    while i < length:
      op, co = bytecode[i][2], bytecode[i][5]
      if op in (IMPORT_FROM, IMPORT_NAME) and co == code_object:
        last_index = i
      i += 1

    if last_index > -1:
      # Need to unroll until the next STORE_NAME
      while last_index < length:
        op = bytecode[last_index][2]
        if op == STORE_NAME:
          break
        last_index += 1
    return last_index
dataset/ETHPy150Open neuroo/equip/equip/bytecode/code.py/BytecodeObject.get_last_import_ref/original