<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _upsampling(lr_array, rescale, reference_shape, interp='linear'):
 """ Upsample the low-resolution array to the original high-resolution grid :param lr_array: Low-resolution array to be upsampled :param rescale: Rescale factor for rows/columns :param reference_shape: Original size of high-resolution eopatch. Tuple with dimension for time, height and width :param interp: Interpolation method ot be used in upsampling. Default is `'linear'` :return: Upsampled array. The array has 4 dimensions, the last one being of size 1 """

        hr_shape = reference_shape + (1,)
        lr_shape = lr_array.shape + (1,)

        if rescale is None:
            return lr_array.reshape(lr_shape)

        out_array = scipy.ndimage.interpolation.zoom(lr_array.reshape(lr_shape),
                                                     (1.0,) + tuple(1 / x for x in rescale) + (1.0,),
                                                     output=lr_array.dtype, order=INTERP_METHODS.index(interp),
                                                     mode='nearest')

        # Padding and cropping might be needed to get to the reference shape
        out_shape = out_array.shape
        padding = tuple((0, np.max((h-o, 0))) for h, o in zip(hr_shape, out_shape))
        hr_array = np.pad(out_array, padding, 'edge')
        hr_array = hr_array[:, :hr_shape[1], :hr_shape[2], :]

        return hr_array