<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_phase(self, nintp=None, rintp=None, delta_offset_x=0, delta_offset_y=0):
 """Interpolate from the border fields to new coordinates Parameters nintp: float or None Refractive index of the sphere rintp: float or None Radius of sphere [m] delta_offset_x: float Offset in x-direction [px] delta_offset_y: float Offset in y-direction [px] Returns ------- phase_intp: 2D real-valued np.ndarray Interpolated phase at the given parameters Notes ----- Not all combinations are poosible, e.g. - One of nintp or rintp must be None - The current interpolation range must include the values for rintp and nintp """

        if nintp is None:
            nintp = self.sphere_index

        if rintp is None:
            rintp = self.radius

        assert (rintp == self.radius or nintp ==
                self.sphere_index), "Only r or n can be changed at a time."
        assert rintp >= self.radius - self.dr
        assert rintp <= self.radius + self.dr
        assert nintp >= self.sphere_index - \
            self.dn, "Out of range: {} !> {}".format(
                nintp, self.sphere_index - self.dn)
        assert nintp <= self.sphere_index + self.dn

        left = self.get_border_phase(0, 0)
        if rintp == self.radius:
            dist = nintp - self.sphere_index
            dmax = self.dn
            if dist < 0:
                righ = self.get_border_phase(-1, 0)
            else:
                righ = self.get_border_phase(1, 0)
        else:
            dist = rintp - self.radius
            dmax = self.dr
            if dist < 0:
                righ = self.get_border_phase(0, -1)
            else:
                righ = self.get_border_phase(0, 1)

        # make dist positive so that we are interpolating from left to right
        dist = np.abs(dist)
        # perform linear interpolation of data.
        phas = left + (righ - left) * dist / dmax

        # interpolation of lateral movement
        ti = time.time()
        ipphas = spintp.RectBivariateSpline(np.arange(phas.shape[0]),
                                            np.arange(phas.shape[1]),
                                            phas)

        if delta_offset_x != 0 or delta_offset_y != 0:
            # Shift the image. The offset values used here
            # are not self.posx_offset and self.posy_offset!
            # The offset values are added to the fields computed
            # with self.posx_offset and self.posy_offset.
            newx = np.arange(phas.shape[0]) + delta_offset_x
            newy = np.arange(phas.shape[1]) + delta_offset_y
            phas = ipphas(newx, newy)
        if self.verbose > 2:
            print("Interpolation time for {}: {}".format(
                  self.model, time.time() - ti))

        return phas + self.pha_offset