import math


def mutual_information(ab,a,b,N, h=1):
    """Calculates mutual information."""
    O = ab / float(N)
    E = (a / float(N)) * (b / float(N))
    E = E * h
    OE = O/E
    I = math.log(OE,2)
    I = round(I,2)
    return I