def process_srv_record(template_record, zone_records):
    """
    Will process an srv record from a template.

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

    An srv record in the template will delete all existing srv records of the
    same name in the zone.
    """
    new_record = {'type': 'SRV', 'name': template_record['name'], 'data':
        template_record['target'], 'ttl': int(template_record['ttl']),
        'protocol': template_record['protocol'], 'service': template_record
        ['service'], 'priority': int(template_record['priority']), 'weight':
        int(template_record['weight']), 'port': int(template_record['port'])}
    for zone_record in zone_records:
        if zone_record['type'].upper() == 'SRV' and zone_record['name'].lower(
            ) == template_record['name'].lower(
            ) and '_replace' not in zone_record:
            zone_record['_delete'] = 1
    return new_record
