You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: idn_sanitizer.rb
    path of file: ./repos/hitobito/app/utils
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

#  Copyright (c) 2012-2021, Jungwacht Blauring Schweiz. This file is part of
#  hitobito and lic
    
  def sanitize_idn(email)
    return email unless email.strip =~ /[^\w@\.\-]/ # simple regexp, skips most unaffected addresses

    parts = email.strip.split('@')
    domain = parts.last
    suffix = ''
    if domain.ends_with?('>')
      domain = domain[0..-2]
      suffix = '>'
    end
    "#{parts.first}@#{SimpleIDN.to_ascii(domain)}#{suffix}"
  end
end