def em_worst_expected_error(n=2, eps=1, delta=1):

    def foo(p):
        return (np.log(p) * (1 - (1 / (1 + ((n - 1) * p)))))
    a = (- minimize_scalar((lambda p: foo(p)), bounds=(0, 1), method='bounded').fun)
    return (((a * 2) * delta) / eps)
def em_worst_expected_error(n=2, eps=1, delta=1):

    def foo(p):
        return (np.log(p) * (1 - (1 / (1 + ((n - 1) * p)))))
    a = (- minimize_scalar((lambda p: foo(p)), bounds=(0, 1), method='bounded').fun)
    return (((a * 2) * delta) / eps)