def inbreeding_as_dispersion(inbreeding, unique_haplotypes):
    """Calculate dispersion parameter of a Dirichlet-multinomial
    distribution assuming equal population frequency of each haplotype.

    Parameters
    ----------
    inbreeding : float
        Expected inbreeding coefficient of the sample.
    unique_haplotypes : int
        Number of possible haplotype alleles at this locus.

    Returns
    -------
    dispersion : float
        Dispersion parameter for all haplotypes.
    """
    return (1 / unique_haplotypes) * ((1 - inbreeding) / inbreeding)