def print_containers_per_group(inventory):
 required_list = ['groups', 'container_name']
 table = prettytable.PrettyTable(required_list)
 for group_name in inventory.keys():
  containers = get_containers_for_group(inventory, group_name)
  if ((containers is None) or (len(containers) < 1)):
   continue
  if ((len(containers) == 1) and ('_' not in containers[0])):
   continue
  row = [group_name, '\n'.join(containers)]
  table.add_row(row)
 for tbl in table.align.keys():
  table.align[tbl] = 'l'
 return table

def print_containers_per_group ( inventory ) : required_list = [ 'groups' , 'container_name' ] table = prettytable . PrettyTable ( required_list ) for group_name in inventory . keys ( ) : containers = get_containers_for_group ( inventory , group_name ) if ( ( containers is None ) or ( len ( containers ) < 1 ) ) : continue if ( ( len ( containers ) == 1 ) and ( '_' not in containers [ 0 ] ) ) : continue row = [ group_name , '\n' . join ( containers ) ] table . add_row ( row ) for tbl in table . align . keys ( ) : table . align [ tbl ] = 'l' return table
return a table of groups and the containers in each group .