def _trim(p, bound):
    """
    Trim a probabilty to be in (bound, 1-bound)

    Parameters
    ----------
    p: numpy.array of numbers (generally between 0 and 1)

    bound: small positive number <.5 to trim probabilities to

    Returns
    -------
    Trimmed p
    """
    p[p<bound]=bound
    p[p>1-bound]=1-bound
    return p