docs: def update_failover_dns_record(env, zone_id, **kwargs):
      """Create a Failover Route53 alias record in _env_ zone.
  
      Args:
          env (str): Deployment environment.
          zone_id (str): Route53 zone id.
  
      Keyword Args:
          dns_name (str): FQDN of application's dns entry to add/update.
          dns_ttl (int): DNS time-to-live (ttl)
          elb_aws_dns (str): DNS A Record of ELB from AWS
          elb_dns_zone_id (str): Zone ID of ELB DNS
          failover_state (str): if the record is primary or secondary
          primary_region (str): Primary AWS region for DNS
      """
      client = boto3.Session(profile_name=env).client('route53')
      response = {}
  
      hosted_zone_info = client.get_hosted_zone(Id=zone_id)
      zone_name = hosted_zone_info['HostedZone']['Name'].rstrip('.')
      dns_name = kwargs.get('dns_name')
  
      # Check that the primary record exists
      failover_state = kwargs.get('failover_state')
      if failover_state.lower() != 'primary':
          primary_record = find_existing_record(env, zone_id, dns_name, check_key='Failover', check_value='PRIMARY')
          if not primary_record:
              raise PrimaryDNSRecordNotFound("Primary Failover DNS record not found: {}".format(dns_name))
  
      if dns_name and dns_name.endswith(zone_name):
          dns_json = get_template(template_file='infrastructure/dns_failover_upsert.json.j2', **kwargs)
          LOG.info('Attempting to create DNS Failover record %s (%s) in Hosted Zone %s (%s)', dns_name,
                   kwargs['elb_aws_dns'], zone_id, zone_name)
          try:
              delete_existing_cname(env, zone_id, dns_name)
              response = client.change_resource_record_sets(
                  HostedZoneId=zone_id,
                  ChangeBatch=json.loads(dns_json), )
              LOG.info('Upserted DNS Failover record %s (%s) in Hosted Zone %s (%s)', dns_name, kwargs['elb_aws_dns'],
                       zone_id, zone_name)
          except botocore.exceptions.ClientError as error:
              LOG.info('Error creating DNS Failover record %s (%s) in Hosted Zone %s (%s)', dns_name,
                       kwargs['elb_aws_dns'], zone_id, zone_name)
              LOG.debug(error)
      else:
          LOG.info('Skipping creating DNS record %s in non-matching Hosted Zone %s (%s)', dns_name, zone_id, zone_name)
  
      LOG.debug('Route53 JSON Response: \n%s', pformat(response))