def opsworks_instance_name_targets_for_instances(ilist):
    """
    Generate targets list by opwsorks instance name
    """
    oin_nodes = {}

    for i in ilist:
        if i.tags is None:
            continue
        for tag in i.tags:
            if tag['Key'] == 'opsworks:instance':
                name = tag['Value']
                if name not in oin_nodes:
                    oin_nodes[name] = []
                oin_nodes[name].append(i.private_ip_address)

    return [('oin:{}'.format(oin), ips) for oin, ips in oin_nodes.items()]
dataset/ETHPy150Open grahamc/ish/ish/aws.py/opsworks_instance_name_targets_for_instances/original