<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ipc_weights(event, time):
 """Compute inverse probability of censoring weights Parameters event : array, shape = (n_samples,) Boolean event indicator. time : array, shape = (n_samples,) Time when a subject experienced an event or was censored. Returns ------- weights : array, shape = (n_samples,) inverse probability of censoring weights """

    if event.all():
        return numpy.ones(time.shape[0])

    unique_time, p = kaplan_meier_estimator(~event, time)

    idx = numpy.searchsorted(unique_time, time[event])
    Ghat = p[idx]

    assert (Ghat > 0).all()

    weights = numpy.zeros(time.shape[0])
    weights[event] = 1.0 / Ghat

    return weights