def process_txt_record(template_record, zone_records):
    """
    Will process a txt record from a template.

    This results in marking zone_records for deletion, and returning
    the new record.

    A TXT record in the template will delete any CNAME in the zone of the same
    host value.

    It will delete TXT records in the zone according to the txtConflict
    settings.
    """
    new_record = {'type': 'TXT', 'name': template_record['host'], 'data':
        template_record['data'], 'ttl': int(template_record['ttl'])}
    for zone_record in zone_records:
        zone_record_type = zone_record['type'].upper()
        if zone_record_type not in ['TXT', 'CNAME'] or zone_record['name'
            ].lower() != template_record['host'].lower(
            ) or '_replace' in zone_record:
            continue
        if zone_record_type == 'CNAME':
            zone_record['_delete'] = 1
        elif zone_record_type == 'TXT':
            if 'txtConflictMatchingMode' in template_record:
                matching_mode = template_record['txtConflictMatchingMode']
            else:
                matching_mode = 'None'
            if matching_mode == 'All':
                zone_record['_delete'] = 1
            elif matching_mode == 'Prefix' and zone_record['data'].startswith(
                template_record['txtConflictMatchingPrefix']):
                zone_record['_delete'] = 1
    return new_record
