<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _sub_expand(self, tags):
 """This called by expand to find cliques Args: tags (list):
 a list of the tags used to get cliques Yields: list : list of sorted tags by start_token this is a clique """

        entities = {}
        graph = self._build_graph(tags)

        # name entities
        for tag in tags:
            for entity_index in xrange(len(tag.get('entities'))):
                node_name = graph_key_from_tag(tag, entity_index)
                if not node_name in entities:
                    entities[node_name] = []
                entities[node_name] += [
                    tag.get('entities', [])[entity_index],
                    tag.get('entities', [])[entity_index].get('confidence'),
                    tag
                ]

        for clique in get_cliques(list(entities), graph):
            result = []
            for entity_name in clique:
                start_token = int(entity_name.split("-")[0])
                old_tag = entities[entity_name][2]
                tag = {
                    'start_token': start_token,
                    'entities': [entities.get(entity_name)[0]],
                    'confidence': entities.get(entity_name)[1] * old_tag.get('confidence', 1.0),
                    'end_token': old_tag.get('end_token'),
                    'match': old_tag.get('entities')[0].get('match'),
                    'key': old_tag.get('entities')[0].get('key'),
                    'from_context': old_tag.get('from_context', False)
                }
                result.append(tag)
            result = sorted(result, key=lambda e: e.get('start_token'))
            yield result