'Spit this resource record set out as XML'

def to_xml(self):

    if ((self.alias_hosted_zone_id is not None) and (self.alias_dns_name is not None)):
        if (self.alias_evaluate_target_health is not None):
            eval_target_health = (self.EvaluateTargetHealth % ('true' if self.alias_evaluate_target_health else 'false'))
        else:
            eval_target_health = ''
        body = (self.AliasBody % {'hosted_zone_id': self.alias_hosted_zone_id, 'dns_name': self.alias_dns_name, 'eval_target_health': eval_target_health})
    else:
        records = ''
        for r in self.resource_records:
            records += (self.ResourceRecordBody % r)
        body = (self.ResourceRecordsBody % {'ttl': self.ttl, 'records': records})
    weight = ''
    if ((self.identifier is not None) and (self.weight is not None)):
        weight = (self.WRRBody % {'identifier': self.identifier, 'weight': self.weight})
    elif ((self.identifier is not None) and (self.region is not None)):
        weight = (self.RRRBody % {'identifier': self.identifier, 'region': self.region})
    elif ((self.identifier is not None) and (self.failover is not None)):
        weight = (self.FailoverBody % {'identifier': self.identifier, 'failover': self.failover})
    health_check = ''
    if (self.health_check is not None):
        health_check = (self.HealthCheckBody % self.health_check)
    params = {'name': self.name, 'type': self.type, 'weight': weight, 'body': body, 'health_check': health_check}
    return (self.XMLBody % params)
