def get_groups_for_container(inventory, container_name):
 groups = {k for (k, v) in inventory.items() if (('hosts' in v) and (container_name in v['hosts']))}
 return groups

def get_groups_for_container ( inventory , container_name ) : groups = { k for ( k , v ) in inventory . items ( ) if ( ( 'hosts' in v ) and ( container_name in v [ 'hosts' ] ) ) } return groups
return groups for a particular container .