def applyMutinfoNorm(mutinfo, entropy, norm='sument'):
    """Apply one of the normalizations discussed in [MLC05]_ to *mutinfo*
    matrix.  *norm* can be one of the following:

      * ``'sument'``: :math:`H(X) + H(Y)`, sum of entropy of columns
      * ``'minent'``: :math:`min\\{H(X), H(Y)\\}`, minimum entropy
      * ``'maxent'``: :math:`max\\{H(X), H(Y)\\}`, maximum entropy
      * ``'mincon'``: :math:`min\\{H(X|Y), H(Y|X)\\}`, minimum conditional
         entropy
      * ``'maxcon'``: :math:`max\\{H(X|Y), H(Y|X)\\}`, maximum conditional
         entropy

    where :math:`H(X)` is the entropy of a column, and
    :math:`H(X|Y) = H(X) - MI(X, Y)`.  Normalization with joint entropy, i.e.
    :math:`H(X, Y)`, can be done using :func:`.buildMutinfoMatrix` *norm*
    argument.

    .. [MLC05] Martin LC, Gloor GB, Dunn SD, Wahl LM. Using information theory
       to search for co-evolving residues in proteins. *Bioinformatics*
       **2005** 21(22):4116-4124."""
    try:
        ndim, shape = mutinfo.ndim, mutinfo.shape
    except AttributeError:
        raise TypeError('mutinfo must be a 2D square array')
    if ndim != 2 or shape[0] != shape[1]:
        raise ValueError('mutinfo must be a 2D square array')
    try:
        ndim, shapent = entropy.ndim, entropy.shape
    except AttributeError:
        raise TypeError('entropy must be a numpy array')
    if ndim != 1:
        raise ValueError('entropy must be a 1D array')
    if shapent[0] != shape[0]:
        raise ValueError('shape of mutinfo and entropy does not match')
    try:
        sw = norm.startswith
    except AttributeError:
        raise TypeError('norm must be a string')
    if sw('sument'):
        norm = lambda i_val, j_val, val: i_val + j_val
    elif sw('minent'):
        norm = lambda i_val, j_val, val: min(i_val, j_val)
    elif sw('maxent'):
        norm = lambda i_val, j_val, val: max(i_val, j_val)
    elif sw('mincon'):
        norm = lambda i_val, j_val, val: min(i_val - val, j_val - val)
    elif sw('maxcon'):
        norm = lambda i_val, j_val, val: max(i_val - val, j_val - val)
    elif sw('joint'):
        raise ValueError(
            'for joint entropy normalization, use buildMutinfoMatrix function')
    else:
        raise ValueError('norm={0} is not a valid normalization type'.
            format(norm))
    mi = mutinfo.copy()
    for i, i_val in enumerate(entropy):
        for j, j_val in enumerate(entropy):
            val = mi[i, j]
            div = norm(i_val, j_val, val)
            if div == 0:
                mi[i, j] = 0
            else:
                mi[i, j] /= div
    return mi
