def add_hosted_zone_id_if_missing(record_set, hosted_zone_id):
    """Add HostedZoneId to Trophosphere record_set object if missing."""
    if not getattr(record_set, "HostedZoneId", None):
        record_set.HostedZoneId = hosted_zone_id
    return record_set