def GetELBInstancesByHealth(region, node_types=None):
 balancers = GetLoadBalancers(region, node_types=node_types)
 res = defaultdict(list)
 for b in balancers:
  for state in b.get_instance_health():
   res[state.state].append(state.instance_id)
 return res

def GetELBInstancesByHealth ( region , node_types = None ) : balancers = GetLoadBalancers ( region , node_types = node_types ) res = defaultdict ( list ) for b in balancers : for state in b . get_instance_health ( ) : res [ state . state ] . append ( state . instance_id ) return res
return a dict of instance ids by health state for the load balancers in a given region .