def METHOD_NAME(
    index_node: Union[nodes.AssignName, nodes.Name],
    loop_node: Union[nodes.For, nodes.Comprehension],
) -> bool:
    """Return whether or not <index_node> is redundant in <loop_node>.
    The lookup method is used in case the original index variable is shadowed
    in the for loop/comprehension's body.
    """
    _, assignments = index_node.lookup(index_node.name)
    if not assignments:
        return False
    elif isinstance(index_node, nodes.AssignName):
        return assignments[0] != loop_node.target
    else:  # isinstance(index_node, nodes.Name)
        return assignments[0] != loop_node.target or _is_load_subscript(index_node, loop_node)