def METHOD_NAME(*plain_text_and_format_entities: tuple[str, list[TypeMessageEntity]]) \
        -> tuple[str, list[TypeMessageEntity]]:
    plain_text = ''
    format_entities = []
    surrogate_len_sum = 0
    for text, entities in plain_text_and_format_entities:
        plain_text += text
        new_entities = []
        for entity in entities:
            new_entity = copy_entity(entity)
            new_entity.offset += surrogate_len_sum
            new_entities.append(new_entity)
        surrogate_len_sum += surrogate_len(text)
        format_entities.extend(new_entities)
    format_entities = merge_contiguous_entities(format_entities)
    return plain_text, format_entities