def reverse_probs(probs):
    """
    Reverses the conditional probability assuming that variables are uniformly distributed

    Parameters
    ----------
    probs : probs[x][y] = Pr(Y=y | X=x)

    Returns
    -------
    reverse : reverse[y][x] = Pr(X=x | Y=y) assuming X is uniform
    """
    reverse = {}
    for x, probs_x in probs.items():
        for y, p in probs_x.items():
            reverse.setdefault(y, {})[x] = p
    for y, probs_y in reverse.items():
        norm = sum(probs_y.values())
        for x, p in probs_y.items():
            probs_y[x] = p / norm
    return reverse