def i_replaced(list_, i, value):
    """Return a new list with element i replaced by value.

    i : value
        Index to replace with value.
    value : value
        Value to replace at index i. None will return original list with element i removed.
    """
    if value is not None:
        return list_[:i] + [value] + list_[i + 1 :]
    else:
        return list_[:i] + list_[i + 1 :]