def calculate_sensitivity(n_rows, child, parents, col_to_binary):
    """Sensitivity function for Bayesian network construction.
    Lemma 4.1 Page 12

    Parameters
    ----------
    n_rows : int
        Number of tuples in sensitive dataset.

    child : str
        one column name

    parents : tuple
        parents of child, there may be multiple parents

    col_to_binary : dict
        mapping from column name to is_binary

    Return
    --------
    int
        Sensitivity value.
    """
    from math import log
    if col_to_binary[child] or len(parents) == 1 and col_to_binary[parents[0]]:
        a = log(n_rows) / n_rows
        b = (1 / n_rows - 1) * log(1 - 1 / n_rows)
        return a + b
    else:
        a = 2 / n_rows * log((n_rows + 1) / 2)
        b = (1 - 1 / n_rows) * log(1 + 2 / (n_rows - 1))
        return a + b
