if end_index < len(template):
                    end_index += template[end_index] == '\r' and 1 or 0