def __get_instance_info(self, instances, status, keyname):
    """ Filter out a list of instances by instance status and keyname.

    Args:
      instances: A list of instances as returned by describe_instances.
      status: Status of the VMs (eg: running, terminated).
      keyname: Keyname used to spawn instances.
    Returns:
      A tuple of the form (public ips, private ips, instance ids).
    """
    instance_ids = []
    public_ips = []
    private_ips = []
    for i in instances:
      if i.state == status and i.key_name == keyname:
        instance_ids.append(i.id)
        public_ips.append(i.public_dns_name)
        private_ips.append(i.private_dns_name)
    return public_ips, private_ips, instance_ids
dataset/ETHPy150Open AppScale/appscale-tools/lib/agents/ec2_agent.py/EC2Agent.__get_instance_info/original