import re


def normalize_double_n(str):
    """
    Normalize double n.
    """
    
    # Replace double n with n'
    str = re.sub("nn", "n'", str)
    # Remove unnecessary apostrophes
    str = re.sub("n'(?=[^aiueoyn]|$)", "n", str)
    
    return str