def _format_evidence_text(stmt):
        def get_role(ag_ix):
            if isinstance(stmt, Complex) or \
               isinstance(stmt, SelfModification) or \
               isinstance(stmt, ActiveForm) or isinstance(stmt, Conversion) or\
               isinstance(stmt, Translocation):
                return 'other'
            else:
                assert len(stmt.agent_list()) == 2, (len(stmt.agent_list()),
                                                     type(stmt))
                return 'subject' if ag_ix == 0 else 'object'
        ev_list = []
        for ix, ev in enumerate(stmt.evidence):
            if ev.source_api == 'biopax' and \
               'source_sub_id' in ev.annotations and \
               ev.annotations['source_sub_id']:
               source_api = '%s:%s' % (ev.source_api,
                                       ev.annotations['source_sub_id'])
            else:
                source_api = ev.source_api
            if ev.text is None:
                format_text = None
            else:
                indices = []
                for ix, ag in enumerate(stmt.agent_list()):
                    if ag is None:
                        continue
                    try:
                        ag_text = ev.annotations['agents']['raw_text'][ix]
                        if ag_text is None:
                            raise KeyError
                    except KeyError:
                        ag_text = ag.db_refs.get('TEXT')
                    if ag_text is None:
                        continue
                    role = get_role(ix)
                    tag_start = '<span class="badge badge-%s">' % role
                    tag_close = '</span>'
                    indices += [(m.start(), m.start() + len(ag_text),
                                 ag_text, tag_start, tag_close)
                                 for m in re.finditer(re.escape(ag_text),
                                                      ev.text)]
                format_text = tag_text(ev.text, indices)
            ev_list.append({'source_api': source_api,
                            'pmid': ev.pmid,
                            'text_refs': ev.text_refs,
                            'text': format_text,
                            'source_hash': ev.source_hash })
        return ev_list