def METHOD_NAME(self):
    entities = []
    new_sent = ""
    last = 0
    for key, value in self.spans.items():
        entity_group = value[-1]
        if re.match("B-", entity_group, re.IGNORECASE) or re.match("I-", entity_group, re.IGNORECASE):
            entity_group = entity_group[2:]
        if entity_group not in self.colors:
            self.colors.update({entity_group: "#%06X" % self.rng.randint(0, 0xFFFFFF)})
        start = key
        new_sent += self.sent[last:start]
        last = end = value[0]
        entity_text = self.html_template(self.sent[start:end], entity_group, color=self.colors[entity_group])
        new_sent += entity_text
    new_sent += self.sent[last:]
    return new_sent