code: def connectiontable(self, state='prodaccepted'):
  		
  		entities = self.list_full(state)
  
  		# sort entities
  		idps = OrderedDict()
  		sps  = OrderedDict()
  		for eid, entity in entities.items():
  			if entity['isActive'] and entity['state']==state:
  				if entity['type']=='saml20-idp':
  					idps[eid] = entity
  				elif entity['type']=='saml20-sp':
  					sps[eid] = entity
  				else:
  					raise(ServiceRegistryError(0,"unknown type `%s' for eid=%s" % (entity['type'],entity['id'])))
  
  		# use numpy here for the connection matrix to simplify extraction of rows and columns lateron
  		max_eid = max(entities.keys())
  		#print(max_eid)
  		connections = dok_matrix((max_eid+1,max_eid+1), dtype=np.bool_)
  
  		for idp_eid, idp_entity in idps.items():
  			#pprint(idp_entity)
  			sps_allowed = set([e['id'] for e in idp_entity['allowedConnections']])
  			for sp_eid, sp_entity in sps.items():
  				idps_allowed = set([ e['id'] for e in sp_entity['allowedConnections'] ])
  
  				acl =     ( idp_entity['allowAllEntities'] or (sp_eid  in sps_allowed ) ) \
  				      and ( sp_entity[ 'allowAllEntities'] or (idp_eid in idps_allowed) )
  				connections[idp_eid,sp_eid] = acl
  
  		self._connections[state] = dict()
  		self._connections[state]['idp'] = idps
  		self._connections[state]['sp' ] = sps
  		self._connections[state]['acl'] = connections
  
  		return connections
docs: Returns a matrix of all entities showing which ones are connected together.