def allocate(reservations, total=1.0):
    """
    Allocate resources among slices with specified and unspecified reservations.

    Returns a new list of values with the following properties:
    - Every value is >= the corresponding input value.
    - The result sums to `total`.

    Examples:
    allocate([0.25, None, None]) -> [0.5, 0.25, 0.25]
    allocate([0.4, None, None]) -> [0.6, 0.2, 0.2]
    allocate([0.2, 0.2, 0.2]) -> [0.33, 0.33, 0.33]
    allocate([None, None, None]) -> [0.33, 0.33, 0.33]
    allocate([0.5, 0.5, 0.5]) -> ERROR
    """
    n = len(reservations)
    if n <= 0:
        return []

    remaining = total
    for r in reservations:
        if r is not None:
            remaining -= r

    result = list(reservations)

    # Divide the remaining resources among all slices.
    if remaining > 0:
        share = float(remaining) / n
        for i in range(n):
            if result[i] is None:
                result[i] = share
            else:
                result[i] += share
    elif remaining < 0:
        raise Exception("Resource allocation is infeasible (total {} > {})".format(
            sum(result), total))

    return result