def METHOD_NAME() -> AnyFormattedText:
    # Split the template in parts.
    parts = self.text.split("{}")
    assert len(parts) - 1 == len(values)
    result = FormattedText()
    for part, val in zip(parts, values):
        result.append(("", part))
        result.extend(to_formatted_text(val))
    result.append(("", parts[-1]))
    return result