<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def bilinear_interp(data, x, y):
 """ Interpolate input ``data`` at "pixel" coordinates ``x`` and ``y``. """

    x = np.asarray(x)
    y = np.asarray(y)
    if x.shape != y.shape:
        raise ValueError("X- and Y-coordinates must have identical shapes.")

    out_shape = x.shape
    out_size = x.size
    x = x.ravel()
    y = y.ravel()

    x0 = np.empty(out_size, dtype=np.int)
    y0 = np.empty(out_size, dtype=np.int)
    np.clip(x, 0, data.shape[1] - 2, out=x0)
    np.clip(y, 0, data.shape[0] - 2, out=y0)
    x1 = x0 + 1
    y1 = y0 + 1

    f00 = data[(y0, x0)]
    f10 = data[(y1, x0)]
    f01 = data[(y0, x1)]
    f11 = data[(y1, x1)]

    w00 = (x1 - x) * (y1 - y)
    w10 = (x1 - x) * (y - y0)
    w01 = (x - x0) * (y1 - y)
    w11 = (x - x0) * (y - y0)

    interp = w00 * f00 + w10 * f10 + w01 * f01 + w11 * f11

    return interp.reshape(out_shape).astype(data.dtype.type)