'substitutes each tag back into string, into occurrences of <0>, <1> etc'

def retag_string(self, string, tags):

    for (i, tag) in enumerate(tags):
        bracketed = ('<%s>' % i)
        try:
            string = re.sub(bracketed, tag, string, 1)
        except Exception as e:
            continue
    return string
