<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def action_display(self):
        '''The action text, with any hyperlinked related entities.'''
        action = self['action']
        annotations = []
        abbr = self.bill[settings.LEVEL_FIELD]
        if 'related_entities' in self:
            for entity in self['related_entities']:
                name = entity['name']
                _id = entity['id']

                # If the importer couldn't ID the entity,
                # skip.
                if _id is None:
                    continue
                url = mongoid_2_url(abbr, _id)
                link = '<a href="%s">%s</a>' % (url, name)
                if name in action:
                    action = action.replace(entity['name'], link)
                else:
                    annotations.append(link)
            if annotations:
                action += ' (%s)' % ', '.join(annotations)
        return action