import unicodedata


def _normalize(unistr):
    """Represent Unicode string with canonical composed form.

    Unicode has alternative representations called normalization forms,
    which means that e.g. "\\u017c" is the same character as "z\\u0307".

    Normalization ensures portability since e.g. filenames on Mac OS X
    are encoded with UTF-8 in NFD (decomposed), while Linux typically
    uses NFC for that purpose.
    """
    return unicodedata.normalize('NFC', unistr)